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

Function getReferencesForSuperKeyword

test/fixtures/snapshot/typescript.js:138548–138581  ·  view source on GitHub ↗
(superKeyword)

Source from the content-addressed store, hash-verified

138546 return inherits;
138547 }
138548 function getReferencesForSuperKeyword(superKeyword) {
138549 var searchSpaceNode = ts.getSuperContainer(superKeyword, /*stopOnFunctions*/ false);
138550 if (!searchSpaceNode) {
138551 return undefined;
138552 }
138553 // Whether 'super' occurs in a static context within a class.
138554 var staticFlag = 32 /* ModifierFlags.Static */;
138555 switch (searchSpaceNode.kind) {
138556 case 167 /* SyntaxKind.PropertyDeclaration */:
138557 case 166 /* SyntaxKind.PropertySignature */:
138558 case 169 /* SyntaxKind.MethodDeclaration */:
138559 case 168 /* SyntaxKind.MethodSignature */:
138560 case 171 /* SyntaxKind.Constructor */:
138561 case 172 /* SyntaxKind.GetAccessor */:
138562 case 173 /* SyntaxKind.SetAccessor */:
138563 staticFlag &= ts.getSyntacticModifierFlags(searchSpaceNode);
138564 searchSpaceNode = searchSpaceNode.parent; // re-assign to be the owning class
138565 break;
138566 default:
138567 return undefined;
138568 }
138569 var sourceFile = searchSpaceNode.getSourceFile();
138570 var references = ts.mapDefined(getPossibleSymbolReferenceNodes(sourceFile, "super", searchSpaceNode), function (node) {
138571 if (node.kind !== 106 /* SyntaxKind.SuperKeyword */) {
138572 return;
138573 }
138574 var container = ts.getSuperContainer(node, /*stopOnFunctions*/ false);
138575 // If we have a 'super' container, we must have an enclosing class.
138576 // Now make sure the owning class is the same as the search-space
138577 // and has the same static qualifier as the original 'super's owner.
138578 return container && ts.isStatic(container) === !!staticFlag && container.parent.symbol === searchSpaceNode.symbol ? nodeEntry(node) : undefined;
138579 });
138580 return [{ definition: { type: 0 /* DefinitionKind.Symbol */, symbol: searchSpaceNode.symbol }, references: references }];
138581 }
138582 function isParameterName(node) {
138583 return node.kind === 79 /* SyntaxKind.Identifier */ && node.parent.kind === 164 /* SyntaxKind.Parameter */ && node.parent.name === node;
138584 }

Callers 1

Calls 2

nodeEntryFunction · 0.85

Tested by

no test coverage detected