Skip to content
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

Merged
merged 4 commits into from
Mar 24, 2015
Merged

Revised name generation #2 #2471

merged 4 commits into from
Mar 24, 2015

Conversation

vladima
Copy link
Contributor

@vladima vladima commented Mar 23, 2015

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

@JsonFreeman
Copy link
Contributor

👍

@@ -11090,7 +10969,7 @@ module ts {
}
}

function getExportNameSubstitution(symbol: Symbol, location: Node): string {
function getExportNameSubstitution(symbol: Symbol, location: Node, getGeneratedNameForNode: (Node: Node) => string): string {
Copy link
Contributor

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.

@CyrusNajmabadi
Copy link
Contributor

👍

// enum values are used to set/check bit values and thus should not have bit collisions.
const enum TempVariableKind {
auto = 0,
_i = 1,
Copy link
Contributor

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.

@mhegazy
Copy link
Contributor

mhegazy commented Mar 24, 2015

👍

vladima added a commit that referenced this pull request Mar 24, 2015
@vladima vladima merged commit e5e5ad8 into master Mar 24, 2015
@vladima vladima deleted the revisedNameGen2 branch March 24, 2015 22:20
@vladima vladima mentioned this pull request Mar 25, 2015
@microsoft microsoft locked and limited conversation to collaborators Jun 18, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Downlevel for 'let' doesn't account for nested declarations
5 participants