-
Notifications
You must be signed in to change notification settings - Fork 12.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Revised name generation #2 #2471
Conversation
👍 |
@@ -11090,7 +10969,7 @@ module ts { | |||
} | |||
} | |||
|
|||
function getExportNameSubstitution(symbol: Symbol, location: Node): string { | |||
function getExportNameSubstitution(symbol: Symbol, location: Node, getGeneratedNameForNode: (Node: Node) => string): string { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe , generateName: NameGenerator
along with type NameGenerator = (node: Node) => string;
?
I find it pretty tough to read these sigs with function types in it. But it's up to you.
👍 |
// enum values are used to set/check bit values and thus should not have bit collisions. | ||
const enum TempVariableKind { | ||
auto = 0, | ||
_i = 1, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
so we are chaining these to a boolean flag.
👍 |
This PR uses
isUnknownIdentifier
from the checker to determine if let\const should be renamed. When new name is generated it will be unique within the set { globals U identifiers-in-file U generated-names }. Names for temp variables and globally uniqie names are generated using different patterns and so should never conflict.Fixes #2449