-
-
Notifications
You must be signed in to change notification settings - Fork 655
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
Less local variable renaming in compiled code #9304
Less local variable renaming in compiled code #9304
Conversation
Wouldn't that re-introduce numbering though? Because you can't do |
Indeed. |
Actually, that depends on a user code. var x = 123;
if(condition) {
var x = 'hello';
trace(x);
}
trace(x); with #9280 will be compiled to let x = 123;
if(condition) {
let x = "hello";
console.log(x);
}
console.log(x); while without #9280 it will be var x = 123;
if(condition) {
var x1 = "hello";
console.log(x1);
}
console.log(x); |
Yes, and that's probably a more real-world case, so go for it :) It's just that the original example with same-block shadowing will not really be improved by |
See #9035
Closes #9296
Finally I've managed to implement something bearable.
This takes into account target rules for local variables scoping.
For example this sample:
when compiled for js:
to cs (no shadowing allowed):
In conjunction with #9280 this will reduce amount of local variables generated for JS even more.