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

Function findSuperConstructorAccesses

test/fixtures/snapshot/typescript.js:138412–138429  ·  view source on GitHub ↗

Find references to `super` in the constructor of an extending class.

(classDeclaration, addNode)

Source from the content-addressed store, hash-verified

138410 }
138411 /** Find references to `super` in the constructor of an extending class. */
138412 function findSuperConstructorAccesses(classDeclaration, addNode) {
138413 var constructor = getClassConstructorSymbol(classDeclaration.symbol);
138414 if (!(constructor && constructor.declarations)) {
138415 return;
138416 }
138417 for (var _i = 0, _a = constructor.declarations; _i < _a.length; _i++) {
138418 var decl = _a[_i];
138419 ts.Debug.assert(decl.kind === 171 /* SyntaxKind.Constructor */);
138420 var body = decl.body;
138421 if (body) {
138422 forEachDescendantOfKind(body, 106 /* SyntaxKind.SuperKeyword */, function (node) {
138423 if (ts.isCallExpressionTarget(node)) {
138424 addNode(node);
138425 }
138426 });
138427 }
138428 }
138429 }
138430 function hasOwnConstructor(classDeclaration) {
138431 return !!getClassConstructorSymbol(classDeclaration.symbol);
138432 }

Callers 1

addConstructorReferencesFunction · 0.85

Calls 3

forEachDescendantOfKindFunction · 0.85
assertMethod · 0.80

Tested by

no test coverage detected