Removed unused code, use valueDeclaration for symbol.

This commit is contained in:
Daniel Rosenwasser
2015-06-03 12:33:53 -07:00
parent 9907d62f3b
commit 693c587b86
2 changed files with 9 additions and 16 deletions
+2 -1
View File
@@ -11833,7 +11833,8 @@ module ts {
if (languageVersion === ScriptTarget.ES3) {
defaultKeyword = "[\"default\"]";
} else {
}
else {
defaultKeyword = ".default";
}
return getGeneratedNameForNode(<ImportDeclaration>node.parent) + defaultKeyword;
+7 -15
View File
@@ -4988,19 +4988,6 @@ module ts {
}
function getDeclaredName(symbol: Symbol, location: Node) {
// Special case for function expressions, whose names are solely local to their bodies.
let functionExpression = forEach(symbol.declarations, d => d.kind === SyntaxKind.FunctionExpression ? <FunctionExpression>d : undefined);
// When a name gets interned into a SourceFile's 'identifiers' Map,
// its name is escaped and stored in the same way its symbol name/identifier
// name should be stored. Function expressions, however, are a special case,
// because despite sometimes having a name, the binder unconditionally binds them
// to a symbol with the name "__function".
let name: string;
if (functionExpression && functionExpression.name) {
name = functionExpression.name.text;
}
// If this is an export or import specifier it could have been renamed using the as syntax.
// if so we want to search for whatever under the cursor, the symbol is pointing to the alias (name)
// so check for the propertyName.
@@ -5008,7 +4995,7 @@ module ts {
return location.getText();
}
name = typeChecker.symbolToString(symbol);
let name = typeChecker.symbolToString(symbol);
return stripQuotes(name);
}
@@ -5022,7 +5009,12 @@ module ts {
}
// Special case for function expressions, whose names are solely local to their bodies.
let functionExpression = forEach(declarations, d => d.kind === SyntaxKind.FunctionExpression ? <FunctionExpression>d : undefined);
// TODO (drosen): Why would we have to lookup the interned name for a function expression?
// Shouldn't we have found a scope? Consider a 'Debug.fail()'.
let functionExpression: FunctionExpression;
if (symbol.valueDeclaration && symbol.valueDeclaration.kind === SyntaxKind.FunctionExpression) {
functionExpression = <FunctionExpression>symbol.valueDeclaration;
}
// When a name gets interned into a SourceFile's 'identifiers' Map,
// its name is escaped and stored in the same way its symbol name/identifier