@@ -12686,10 +12686,7 @@ namespace ts {
12686
12686
// we will add the symbol into the table using its declared name
12687
12687
let name = (<FunctionExpression|ClassExpression>location).name;
12688
12688
if (name) {
12689
- let symbol = location.symbol;
12690
- if (symbol.flags & meaning && !hasProperty(symbols, name.text)) {
12691
- symbols[name.text] = symbol;
12692
- }
12689
+ copySymbol(location.symbol, meaning, name.text);
12693
12690
}
12694
12691
break;
12695
12692
}
@@ -12701,11 +12698,18 @@ namespace ts {
12701
12698
copySymbols(globals, meaning);
12702
12699
}
12703
12700
12704
- // Returns 'true' if we should stop processing symbols.
12705
- function copySymbol(symbol: Symbol, meaning: SymbolFlags): void {
12701
+ /**
12702
+ * Copy the given symbol into symbol tables if the symbol has the given meaning
12703
+ * and it doesn't already existed in the symbol table
12704
+ *
12705
+ * @param symbol the symbol to be added into symbol table
12706
+ * @param meaning meaning of symbol to filter by before adding to symbol table
12707
+ * @param key a key for storing in symbol table; if null, use symbol.name
12708
+ */
12709
+ function copySymbol(symbol: Symbol, meaning: SymbolFlags, key?: string): void {
12706
12710
if (symbol.flags & meaning) {
12707
- let id = symbol.name;
12708
- if (!isReservedMemberName(id) && ! hasProperty(symbols, id)) {
12711
+ let id = key || symbol.name;
12712
+ if (!hasProperty(symbols, id)) {
12709
12713
symbols[id] = symbol;
12710
12714
}
12711
12715
}
@@ -12714,9 +12718,7 @@ namespace ts {
12714
12718
function copySymbols(source: SymbolTable, meaning: SymbolFlags): void {
12715
12719
if (meaning) {
12716
12720
for (let id in source) {
12717
- if (hasProperty(source, id)) {
12718
- copySymbol(source[id], meaning);
12719
- }
12721
+ copySymbol(source[id], meaning);
12720
12722
}
12721
12723
}
12722
12724
}
0 commit comments