Skip to content

Fix #22866: Condition checking for name collision of generated variable names on emit happening - #22886

Merged
Mohamed Hegazy (mhegazy) merged 2 commits into
masterfrom
Fix22866
Mar 26, 2018
Merged

Mohamed Hegazy (mhegazy) merged 2 commits into
masterfrom
Fix22866

Conversation

@mhegazy

Copy link
Copy Markdown
Contributor

Fixes #22866

@sandersn

Copy link
Copy Markdown
Member

Looks like there is lint :(

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, just one question about the tests.



// shadowed require
var require = 0;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

are these actually shadowed? I thought they came from @types/node. In tests I've written, I've had trouble getting them to be declared instead of the other way round.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it is just that the emitter expects them to exist and to mean something specific when --module is AMD or CommonJS. this ensures that users do not accidentally define a local variable with the same name.

@weswigham Wesley Wigham (weswigham) left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks like an improvement; but shouldn't we just start using (optimistic) unique names for these temporaries in our emit (so we just use a different variable if there would be a conflict)?

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.

3 participants