I expected this to work:
::x = 5;
fn addToX(x) {
return ::x + x;
}
::console.log(addToX(2)); // 7
However it compiles to (with ES6 target):
"use strict";
(function () {
x = 5;
function addToX(x) {
return x + x;
}
console.log(addToX(2)); // 4
}());
The compiler should maybe rename the local x so that the ::x accesses the global x:
x = 5;
function addToX(x_) {
return x + x_;
}
The same should hold for local variables, and for use.
I expected this to work:
However it compiles to (with ES6 target):
The compiler should maybe rename the local
xso that the::xaccesses the globalx:The same should hold for local variables, and for
use.