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

Function addClassStaticThisReferences

test/fixtures/snapshot/typescript.js:138354–138377  ·  view source on GitHub ↗
(referenceLocation, search, state)

Source from the content-addressed store, hash-verified

138352 }
138353 }
138354 function addClassStaticThisReferences(referenceLocation, search, state) {
138355 addReference(referenceLocation, search.symbol, state);
138356 var classLike = referenceLocation.parent;
138357 if (state.options.use === 2 /* FindReferencesUse.Rename */ || !ts.isClassLike(classLike))
138358 return;
138359 ts.Debug.assert(classLike.name === referenceLocation);
138360 var addRef = state.referenceAdder(search.symbol);
138361 for (var _i = 0, _a = classLike.members; _i < _a.length; _i++) {
138362 var member = _a[_i];
138363 if (!(ts.isMethodOrAccessor(member) && ts.isStatic(member))) {
138364 continue;
138365 }
138366 if (member.body) {
138367 member.body.forEachChild(function cb(node) {
138368 if (node.kind === 108 /* SyntaxKind.ThisKeyword */) {
138369 addRef(node);
138370 }
138371 else if (!ts.isFunctionLike(node) && !ts.isClassLike(node)) {
138372 node.forEachChild(cb);
138373 }
138374 });
138375 }
138376 }
138377 }
138378 /**
138379 * `classSymbol` is the class where the constructor was defined.
138380 * Reference the constructor and all calls to `new this()`.

Callers 1

getReferencesAtLocationFunction · 0.85

Calls 4

addReferenceFunction · 0.85
addRefFunction · 0.85
assertMethod · 0.80
forEachChildMethod · 0.80

Tested by

no test coverage detected