(changes, sourceFile, containingFunction, program, host, cancellationToken)
| 156737 | } |
| 156738 | } |
| 156739 | function annotateThis(changes, sourceFile, containingFunction, program, host, cancellationToken) { |
| 156740 | var references = getFunctionReferences(containingFunction, sourceFile, program, cancellationToken); |
| 156741 | if (!references || !references.length) { |
| 156742 | return; |
| 156743 | } |
| 156744 | var thisInference = inferTypeFromReferences(program, references, cancellationToken).thisParameter(); |
| 156745 | var typeNode = ts.getTypeNodeIfAccessible(thisInference, containingFunction, program, host); |
| 156746 | if (!typeNode) { |
| 156747 | return; |
| 156748 | } |
| 156749 | if (ts.isInJSFile(containingFunction)) { |
| 156750 | annotateJSDocThis(changes, sourceFile, containingFunction, typeNode); |
| 156751 | } |
| 156752 | else { |
| 156753 | changes.tryInsertThisTypeAnnotation(sourceFile, containingFunction, typeNode); |
| 156754 | } |
| 156755 | } |
| 156756 | function annotateJSDocThis(changes, sourceFile, containingFunction, typeNode) { |
| 156757 | changes.addJSDocTags(sourceFile, containingFunction, [ |
| 156758 | ts.factory.createJSDocThisTag(/*tagName*/ undefined, ts.factory.createJSDocTypeExpression(typeNode)), |
no test coverage detected