MCPcopy Index your code
hub / github.com/nodejs/node / cloneNodeBuilderContext

Function cloneNodeBuilderContext

test/fixtures/snapshot/typescript.js:53881–53906  ·  view source on GitHub ↗
(context)

Source from the content-addressed store, hash-verified

53879 }
53880 }
53881 function cloneNodeBuilderContext(context) {
53882 var initial = __assign({}, context);
53883 // Make type parameters created within this context not consume the name outside this context
53884 // The symbol serializer ends up creating many sibling scopes that all need "separate" contexts when
53885 // it comes to naming things - within a normal `typeToTypeNode` call, the node builder only ever descends
53886 // through the type tree, so the only cases where we could have used distinct sibling scopes was when there
53887 // were multiple generic overloads with similar generated type parameter names
53888 // The effect:
53889 // When we write out
53890 // export const x: <T>(x: T) => T
53891 // export const y: <T>(x: T) => T
53892 // we write it out like that, rather than as
53893 // export const x: <T>(x: T) => T
53894 // export const y: <T_1>(x: T_1) => T_1
53895 if (initial.typeParameterNames) {
53896 initial.typeParameterNames = new ts.Map(initial.typeParameterNames);
53897 }
53898 if (initial.typeParameterNamesByText) {
53899 initial.typeParameterNamesByText = new ts.Set(initial.typeParameterNamesByText);
53900 }
53901 if (initial.typeParameterSymbolList) {
53902 initial.typeParameterSymbolList = new ts.Set(initial.typeParameterSymbolList);
53903 }
53904 initial.tracker = wrapSymbolTrackerToReportForContext(initial, initial.tracker);
53905 return initial;
53906 }
53907 function getDeclarationWithTypeAnnotation(symbol, enclosingDeclaration) {
53908 return symbol.declarations && ts.find(symbol.declarations, function (s) { return !!ts.getEffectiveTypeAnnotationNode(s) && (!enclosingDeclaration || !!ts.findAncestor(s, function (n) { return n === enclosingDeclaration; })); });
53909 }

Callers 1

serializeSymbolFunction · 0.85

Tested by

no test coverage detected