(node)
| 136841 | } |
| 136842 | FindAllReferences.isContextWithStartAndEndNode = isContextWithStartAndEndNode; |
| 136843 | function getContextNodeForNodeEntry(node) { |
| 136844 | if (ts.isDeclaration(node)) { |
| 136845 | return getContextNode(node); |
| 136846 | } |
| 136847 | if (!node.parent) |
| 136848 | return undefined; |
| 136849 | if (!ts.isDeclaration(node.parent) && !ts.isExportAssignment(node.parent)) { |
| 136850 | // Special property assignment in javascript |
| 136851 | if (ts.isInJSFile(node)) { |
| 136852 | var binaryExpression = ts.isBinaryExpression(node.parent) ? |
| 136853 | node.parent : |
| 136854 | ts.isAccessExpression(node.parent) && |
| 136855 | ts.isBinaryExpression(node.parent.parent) && |
| 136856 | node.parent.parent.left === node.parent ? |
| 136857 | node.parent.parent : |
| 136858 | undefined; |
| 136859 | if (binaryExpression && ts.getAssignmentDeclarationKind(binaryExpression) !== 0 /* AssignmentDeclarationKind.None */) { |
| 136860 | return getContextNode(binaryExpression); |
| 136861 | } |
| 136862 | } |
| 136863 | // Jsx Tags |
| 136864 | if (ts.isJsxOpeningElement(node.parent) || ts.isJsxClosingElement(node.parent)) { |
| 136865 | return node.parent.parent; |
| 136866 | } |
| 136867 | else if (ts.isJsxSelfClosingElement(node.parent) || |
| 136868 | ts.isLabeledStatement(node.parent) || |
| 136869 | ts.isBreakOrContinueStatement(node.parent)) { |
| 136870 | return node.parent; |
| 136871 | } |
| 136872 | else if (ts.isStringLiteralLike(node)) { |
| 136873 | var validImport = ts.tryGetImportFromModuleSpecifier(node); |
| 136874 | if (validImport) { |
| 136875 | var declOrStatement = ts.findAncestor(validImport, function (node) { |
| 136876 | return ts.isDeclaration(node) || |
| 136877 | ts.isStatement(node) || |
| 136878 | ts.isJSDocTag(node); |
| 136879 | }); |
| 136880 | return ts.isDeclaration(declOrStatement) ? |
| 136881 | getContextNode(declOrStatement) : |
| 136882 | declOrStatement; |
| 136883 | } |
| 136884 | } |
| 136885 | // Handle computed property name |
| 136886 | var propertyName = ts.findAncestor(node, ts.isComputedPropertyName); |
| 136887 | return propertyName ? |
| 136888 | getContextNode(propertyName.parent) : |
| 136889 | undefined; |
| 136890 | } |
| 136891 | if (node.parent.name === node || // node is name of declaration, use parent |
| 136892 | ts.isConstructorDeclaration(node.parent) || |
| 136893 | ts.isExportAssignment(node.parent) || |
| 136894 | // Property name of the import export specifier or binding pattern, use parent |
| 136895 | ((ts.isImportOrExportSpecifier(node.parent) || ts.isBindingElement(node.parent)) |
| 136896 | && node.parent.propertyName === node) || |
| 136897 | // Is default export |
| 136898 | (node.kind === 88 /* SyntaxKind.DefaultKeyword */ && ts.hasSyntacticModifier(node.parent, 513 /* ModifierFlags.ExportDefault */))) { |
| 136899 | return getContextNode(node.parent); |
| 136900 | } |
no test coverage detected
searching dependent graphs…