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

change top-level variable declarations with initialiser to assignments #99

Open
michaelficarra opened this issue Aug 31, 2014 · 2 comments

Comments

@michaelficarra
Copy link
Member

var a = 0;

can become

a=0

at program level. Any assignment to a non-computed member access on this at program level can be similarly transformed:

this.a = 0;

can become

a=0
@Constellation
Copy link
Member

When the script is strict code, it becomes ReferenceError.

'use strict';
Hello = 42;  // ReferenceError

So we cannot apply this to strict code, and as the result, I think this optimization rarely works. Do you think about this?

@michaelficarra
Copy link
Member Author

I'm sure the vast majority of top-level code is not in strict mode.

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

No branches or pull requests

2 participants