(node)
| 51078 | } |
| 51079 | } |
| 51080 | function getAssignmentDeclarationLocation(node) { |
| 51081 | var typeAlias = ts.findAncestor(node, function (node) { return !(ts.isJSDocNode(node) || node.flags & 8388608 /* NodeFlags.JSDoc */) ? "quit" : ts.isJSDocTypeAlias(node); }); |
| 51082 | if (typeAlias) { |
| 51083 | return; |
| 51084 | } |
| 51085 | var host = ts.getJSDocHost(node); |
| 51086 | if (host && ts.isExpressionStatement(host) && ts.isPrototypePropertyAssignment(host.expression)) { |
| 51087 | // /** @param {K} p */ X.prototype.m = function () { } <-- look for K on X's declaration |
| 51088 | var symbol = getSymbolOfNode(host.expression.left); |
| 51089 | if (symbol) { |
| 51090 | return getDeclarationOfJSPrototypeContainer(symbol); |
| 51091 | } |
| 51092 | } |
| 51093 | if (host && ts.isFunctionExpression(host) && ts.isPrototypePropertyAssignment(host.parent) && ts.isExpressionStatement(host.parent.parent)) { |
| 51094 | // X.prototype.m = /** @param {K} p */ function () { } <-- look for K on X's declaration |
| 51095 | var symbol = getSymbolOfNode(host.parent.left); |
| 51096 | if (symbol) { |
| 51097 | return getDeclarationOfJSPrototypeContainer(symbol); |
| 51098 | } |
| 51099 | } |
| 51100 | if (host && (ts.isObjectLiteralMethod(host) || ts.isPropertyAssignment(host)) && |
| 51101 | ts.isBinaryExpression(host.parent.parent) && |
| 51102 | ts.getAssignmentDeclarationKind(host.parent.parent) === 6 /* AssignmentDeclarationKind.Prototype */) { |
| 51103 | // X.prototype = { /** @param {K} p */m() { } } <-- look for K on X's declaration |
| 51104 | var symbol = getSymbolOfNode(host.parent.parent.left); |
| 51105 | if (symbol) { |
| 51106 | return getDeclarationOfJSPrototypeContainer(symbol); |
| 51107 | } |
| 51108 | } |
| 51109 | var sig = ts.getEffectiveJSDocHost(node); |
| 51110 | if (sig && ts.isFunctionLike(sig)) { |
| 51111 | var symbol = getSymbolOfNode(sig); |
| 51112 | return symbol && symbol.valueDeclaration; |
| 51113 | } |
| 51114 | } |
| 51115 | function getDeclarationOfJSPrototypeContainer(symbol) { |
| 51116 | var decl = symbol.parent.valueDeclaration; |
| 51117 | if (!decl) { |
no test coverage detected
searching dependent graphs…