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

ensure name suggestions are legal identifiers #696

Merged
merged 1 commit into from
Jun 7, 2016

Conversation

Rich-Harris
Copy link
Contributor

This fixes a bug exposed by rollup/rollup-plugin-babel#55 – it's possible for a module to export a binding that is a reserved word, and for another module to import that reserved word, without ever writing a syntax error...

// helpers.js
var _typeof = x => typeof x;
export { _typeof as typeof };

// main.js
import * as helpers from './helpers.js';
console.log( helpers.typeof( 1 ) );

(The export from helpers.js might be against spec, I'm not sure. That would be a separate issue if it is.)

This PR ensures that the use of helpers.typeof doesn't cause the var _typeof to be rewritten as var typeof.

@eventualbuddha
Copy link
Contributor

Looks good!

@Rich-Harris Rich-Harris merged commit 3f43f62 into master Jun 7, 2016
@Rich-Harris Rich-Harris deleted the ignore-illegal-name-suggestions branch June 7, 2016 15:25
@Victorystick
Copy link
Contributor

@Rich-Harris @eventualbuddha I'm pretty sure the only export name that mustn't be a valid variable name is default.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants