(node, allowDeclaration)
| 77001 | return init ? getSymbolOfNode(init) : undefined; |
| 77002 | } |
| 77003 | function getSymbolOfExpando(node, allowDeclaration) { |
| 77004 | if (!node.parent) { |
| 77005 | return undefined; |
| 77006 | } |
| 77007 | var name; |
| 77008 | var decl; |
| 77009 | if (ts.isVariableDeclaration(node.parent) && node.parent.initializer === node) { |
| 77010 | if (!ts.isInJSFile(node) && !(ts.isVarConst(node.parent) && ts.isFunctionLikeDeclaration(node))) { |
| 77011 | return undefined; |
| 77012 | } |
| 77013 | name = node.parent.name; |
| 77014 | decl = node.parent; |
| 77015 | } |
| 77016 | else if (ts.isBinaryExpression(node.parent)) { |
| 77017 | var parentNode = node.parent; |
| 77018 | var parentNodeOperator = node.parent.operatorToken.kind; |
| 77019 | if (parentNodeOperator === 63 /* SyntaxKind.EqualsToken */ && (allowDeclaration || parentNode.right === node)) { |
| 77020 | name = parentNode.left; |
| 77021 | decl = name; |
| 77022 | } |
| 77023 | else if (parentNodeOperator === 56 /* SyntaxKind.BarBarToken */ || parentNodeOperator === 60 /* SyntaxKind.QuestionQuestionToken */) { |
| 77024 | if (ts.isVariableDeclaration(parentNode.parent) && parentNode.parent.initializer === parentNode) { |
| 77025 | name = parentNode.parent.name; |
| 77026 | decl = parentNode.parent; |
| 77027 | } |
| 77028 | else if (ts.isBinaryExpression(parentNode.parent) && parentNode.parent.operatorToken.kind === 63 /* SyntaxKind.EqualsToken */ && (allowDeclaration || parentNode.parent.right === parentNode)) { |
| 77029 | name = parentNode.parent.left; |
| 77030 | decl = name; |
| 77031 | } |
| 77032 | if (!name || !ts.isBindableStaticNameExpression(name) || !ts.isSameEntityName(name, parentNode.left)) { |
| 77033 | return undefined; |
| 77034 | } |
| 77035 | } |
| 77036 | } |
| 77037 | else if (allowDeclaration && ts.isFunctionDeclaration(node)) { |
| 77038 | name = node.name; |
| 77039 | decl = node; |
| 77040 | } |
| 77041 | if (!decl || !name || (!allowDeclaration && !ts.getExpandoInitializer(node, ts.isPrototypeAccess(name)))) { |
| 77042 | return undefined; |
| 77043 | } |
| 77044 | return getSymbolOfNode(decl); |
| 77045 | } |
| 77046 | function getAssignedJSPrototype(node) { |
| 77047 | if (!node.parent) { |
| 77048 | return false; |
no test coverage detected
searching dependent graphs…