* `classSymbol` is the class where the constructor was defined. * Reference the constructor and all calls to `new this()`.
(classSymbol, sourceFile, addNode)
| 138380 | * Reference the constructor and all calls to `new this()`. |
| 138381 | */ |
| 138382 | function findOwnConstructorReferences(classSymbol, sourceFile, addNode) { |
| 138383 | var constructorSymbol = getClassConstructorSymbol(classSymbol); |
| 138384 | if (constructorSymbol && constructorSymbol.declarations) { |
| 138385 | for (var _i = 0, _a = constructorSymbol.declarations; _i < _a.length; _i++) { |
| 138386 | var decl = _a[_i]; |
| 138387 | var ctrKeyword = ts.findChildOfKind(decl, 134 /* SyntaxKind.ConstructorKeyword */, sourceFile); |
| 138388 | ts.Debug.assert(decl.kind === 171 /* SyntaxKind.Constructor */ && !!ctrKeyword); |
| 138389 | addNode(ctrKeyword); |
| 138390 | } |
| 138391 | } |
| 138392 | if (classSymbol.exports) { |
| 138393 | classSymbol.exports.forEach(function (member) { |
| 138394 | var decl = member.valueDeclaration; |
| 138395 | if (decl && decl.kind === 169 /* SyntaxKind.MethodDeclaration */) { |
| 138396 | var body = decl.body; |
| 138397 | if (body) { |
| 138398 | forEachDescendantOfKind(body, 108 /* SyntaxKind.ThisKeyword */, function (thisKeyword) { |
| 138399 | if (ts.isNewExpressionTarget(thisKeyword)) { |
| 138400 | addNode(thisKeyword); |
| 138401 | } |
| 138402 | }); |
| 138403 | } |
| 138404 | } |
| 138405 | }); |
| 138406 | } |
| 138407 | } |
| 138408 | function getClassConstructorSymbol(classSymbol) { |
| 138409 | return classSymbol.members && classSymbol.members.get("__constructor" /* InternalSymbolName.Constructor */); |
| 138410 | } |
no test coverage detected