(entry, originalNode, checker)
| 137150 | } |
| 137151 | } |
| 137152 | function getPrefixAndSuffixText(entry, originalNode, checker) { |
| 137153 | if (entry.kind !== 0 /* EntryKind.Span */ && ts.isIdentifier(originalNode)) { |
| 137154 | var node = entry.node, kind = entry.kind; |
| 137155 | var parent = node.parent; |
| 137156 | var name = originalNode.text; |
| 137157 | var isShorthandAssignment = ts.isShorthandPropertyAssignment(parent); |
| 137158 | if (isShorthandAssignment || (ts.isObjectBindingElementWithoutPropertyName(parent) && parent.name === node && parent.dotDotDotToken === undefined)) { |
| 137159 | var prefixColon = { prefixText: name + ": " }; |
| 137160 | var suffixColon = { suffixText: ": " + name }; |
| 137161 | if (kind === 3 /* EntryKind.SearchedLocalFoundProperty */) { |
| 137162 | return prefixColon; |
| 137163 | } |
| 137164 | if (kind === 4 /* EntryKind.SearchedPropertyFoundLocal */) { |
| 137165 | return suffixColon; |
| 137166 | } |
| 137167 | // In `const o = { x }; o.x`, symbolAtLocation at `x` in `{ x }` is the property symbol. |
| 137168 | // For a binding element `const { x } = o;`, symbolAtLocation at `x` is the property symbol. |
| 137169 | if (isShorthandAssignment) { |
| 137170 | var grandParent = parent.parent; |
| 137171 | if (ts.isObjectLiteralExpression(grandParent) && |
| 137172 | ts.isBinaryExpression(grandParent.parent) && |
| 137173 | ts.isModuleExportsAccessExpression(grandParent.parent.left)) { |
| 137174 | return prefixColon; |
| 137175 | } |
| 137176 | return suffixColon; |
| 137177 | } |
| 137178 | else { |
| 137179 | return prefixColon; |
| 137180 | } |
| 137181 | } |
| 137182 | else if (ts.isImportSpecifier(parent) && !parent.propertyName) { |
| 137183 | // If the original symbol was using this alias, just rename the alias. |
| 137184 | var originalSymbol = ts.isExportSpecifier(originalNode.parent) ? checker.getExportSpecifierLocalTargetSymbol(originalNode.parent) : checker.getSymbolAtLocation(originalNode); |
| 137185 | return ts.contains(originalSymbol.declarations, parent) ? { prefixText: name + " as " } : ts.emptyOptions; |
| 137186 | } |
| 137187 | else if (ts.isExportSpecifier(parent) && !parent.propertyName) { |
| 137188 | // If the symbol for the node is same as declared node symbol use prefix text |
| 137189 | return originalNode === entry.node || checker.getSymbolAtLocation(originalNode) === checker.getSymbolAtLocation(entry.node) ? |
| 137190 | { prefixText: name + " as " } : |
| 137191 | { suffixText: " as " + name }; |
| 137192 | } |
| 137193 | } |
| 137194 | return ts.emptyOptions; |
| 137195 | } |
| 137196 | function toImplementationLocation(entry, checker) { |
| 137197 | var documentSpan = entryToDocumentSpan(entry); |
| 137198 | if (entry.kind !== 0 /* EntryKind.Span */) { |
no test coverage detected