MCPcopy Create free account
hub / github.com/nodejs/node / instantiateSymbol

Function instantiateSymbol

test/fixtures/snapshot/typescript.js:63373–63401  ·  view source on GitHub ↗
(symbol, mapper)

Source from the content-addressed store, hash-verified

63371 return result;
63372 }
63373 function instantiateSymbol(symbol, mapper) {
63374 var links = getSymbolLinks(symbol);
63375 if (links.type && !couldContainTypeVariables(links.type)) {
63376 // If the type of the symbol is already resolved, and if that type could not possibly
63377 // be affected by instantiation, simply return the symbol itself.
63378 return symbol;
63379 }
63380 if (ts.getCheckFlags(symbol) & 1 /* CheckFlags.Instantiated */) {
63381 // If symbol being instantiated is itself a instantiation, fetch the original target and combine the
63382 // type mappers. This ensures that original type identities are properly preserved and that aliases
63383 // always reference a non-aliases.
63384 symbol = links.target;
63385 mapper = combineTypeMappers(links.mapper, mapper);
63386 }
63387 // Keep the flags from the symbol we're instantiating. Mark that is instantiated, and
63388 // also transient so that we can just store data on it directly.
63389 var result = createSymbol(symbol.flags, symbol.escapedName, 1 /* CheckFlags.Instantiated */ | ts.getCheckFlags(symbol) & (8 /* CheckFlags.Readonly */ | 4096 /* CheckFlags.Late */ | 16384 /* CheckFlags.OptionalParameter */ | 32768 /* CheckFlags.RestParameter */));
63390 result.declarations = symbol.declarations;
63391 result.parent = symbol.parent;
63392 result.target = symbol;
63393 result.mapper = mapper;
63394 if (symbol.valueDeclaration) {
63395 result.valueDeclaration = symbol.valueDeclaration;
63396 }
63397 if (links.nameType) {
63398 result.nameType = links.nameType;
63399 }
63400 return result;
63401 }
63402 function getObjectTypeInstantiation(type, mapper, aliasSymbol, aliasTypeArguments) {
63403 var declaration = type.objectFlags & 4 /* ObjectFlags.Reference */ ? type.node :
63404 type.objectFlags & 8388608 /* ObjectFlags.InstantiationExpressionType */ ? type.node :

Callers 2

instantiateSignatureFunction · 0.85

Calls 4

getSymbolLinksFunction · 0.85
combineTypeMappersFunction · 0.85
createSymbolFunction · 0.85

Tested by

no test coverage detected