-
Notifications
You must be signed in to change notification settings - Fork 13.1k
Closed
Labels
BugA bug in TypeScriptA bug in TypeScriptFixedA PR has been merged for this issueA PR has been merged for this issue
Milestone
Description
Right now, we have two ways of generating a name in the compiler:
createTempVariablein the emittergenerateUniqueNamein utilities.
The second one can further be split into two callers:
getGeneratedNamesForSourceFilein the checkergenerateUniqueNameForLocationin the emitter
We also have 3 ways to track whether a name is unique, and both methods of generating a name do all of these:
- NodeLinks.generatedNames tracks the names generated for a file, and considers them all used.
tempCountincreateTempVariablekeeps track of a different set of names per file by using a counter- The ScopeFrame stack in the emitter keeps track of names per scope (lastFrame, currentScopeNames, etc)
All of these things need to be consolidated. There are some desirable qualities we want the solution to have:
- Only one way for callers to make a unique name in the compiler.
- This way should support the case where the caller prefers some ideal base name to use, and the case where any old name will do.
- We need to decide whether uniqueness should be tracked per file or per scope, and treat uniqueness that way consistently throughout the compiler.
Metadata
Metadata
Assignees
Labels
BugA bug in TypeScriptA bug in TypeScriptFixedA PR has been merged for this issueA PR has been merged for this issue