Same trick for symbol.id, and always set it to 0.

This commit is contained in:
Daniel Rosenwasser 2021-11-09 00:34:36 +00:00 committed by GitHub
parent f9d2db3540
commit ced38f315e
3 changed files with 6 additions and 5 deletions

View file

@ -287,12 +287,13 @@ namespace ts {
}
export function getSymbolId(symbol: Symbol): SymbolId {
if (!symbol.id) {
symbol.id = nextSymbolId;
let id = symbol.id;
if (!id) {
symbol.id = id = nextSymbolId;
nextSymbolId++;
}
return symbol.id;
return id;
}
export function isInstantiatedModule(node: ModuleDeclaration, preserveConstEnums: boolean) {

View file

@ -4900,7 +4900,7 @@ namespace ts {
members?: SymbolTable; // Class, interface or object literal instance members
exports?: SymbolTable; // Module exports
globalExports?: SymbolTable; // Conditional global UMD exports
/* @internal */ id?: SymbolId; // Unique id (used to look up SymbolLinks)
/* @internal */ id: SymbolId; // Unique id (used to look up SymbolLinks)
/* @internal */ mergeId?: number; // Merge id (used to look up merged symbol)
/* @internal */ parent?: Symbol; // Parent symbol
/* @internal */ exportSymbol?: Symbol; // Exported symbol associated with this symbol

View file

@ -5798,7 +5798,7 @@ namespace ts {
this.escapedName = name;
this.declarations = undefined;
this.valueDeclaration = undefined;
this.id = undefined;
this.id = 0;
this.mergeId = undefined;
this.parent = undefined;
}