mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-05-21 08:25:43 -05:00
Don't intern all strings and numbers. Just the ones used as declaration names.
This commit is contained in:
@@ -4044,7 +4044,16 @@ module ts {
|
||||
break;
|
||||
case SyntaxKind.StringLiteral:
|
||||
case SyntaxKind.NumericLiteral:
|
||||
nameTable[(<LiteralExpression>node).text] = (<LiteralExpression>node).text;
|
||||
// We want to store any numbers/strings if they were a name that could be
|
||||
// related to a declaration. So, if we have 'import x = require("something")'
|
||||
// then we want 'something' to be in the name table. Similarly, if we have
|
||||
// "a['propname']" then we want to store "propname" in the name table.
|
||||
if (isDeclarationName(node) ||
|
||||
node.parent.kind === SyntaxKind.ExternalModuleReference ||
|
||||
isArgumentOfElementAccessExpression(node)) {
|
||||
|
||||
nameTable[(<LiteralExpression>node).text] = (<LiteralExpression>node).text;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
forEachChild(node, walk);
|
||||
@@ -4052,6 +4061,13 @@ module ts {
|
||||
}
|
||||
}
|
||||
|
||||
function isArgumentOfElementAccessExpression(node: Node) {
|
||||
return node &&
|
||||
node.parent &&
|
||||
node.parent.kind === SyntaxKind.ElementAccessExpression &&
|
||||
(<ElementAccessExpression>node.parent).argumentExpression === node;
|
||||
}
|
||||
|
||||
function getReferencesForNode(node: Node, sourceFiles: SourceFile[], searchOnlyInCurrentFile: boolean, findInStrings: boolean, findInComments: boolean): ReferenceEntry[] {
|
||||
// Labels
|
||||
if (isLabelName(node)) {
|
||||
|
||||
Reference in New Issue
Block a user