fix default parameters transformer for loops
This commit is contained in:
parent
51c6a3fffc
commit
a01802300f
@ -11,8 +11,6 @@ exports.Function = function (node, parent, file, scope) {
|
|||||||
});
|
});
|
||||||
|
|
||||||
var iife = false;
|
var iife = false;
|
||||||
var i;
|
|
||||||
var def;
|
|
||||||
|
|
||||||
var checkTDZ = function (ids) {
|
var checkTDZ = function (ids) {
|
||||||
var check = function (node, parent) {
|
var check = function (node, parent) {
|
||||||
@ -31,8 +29,8 @@ exports.Function = function (node, parent, file, scope) {
|
|||||||
traverse(def, { enter: check });
|
traverse(def, { enter: check });
|
||||||
};
|
};
|
||||||
|
|
||||||
for (i = 0; i < node.defaults.length; i++) {
|
for (var i = 0; i < node.defaults.length; i++) {
|
||||||
def = node.defaults[i];
|
var def = node.defaults[i];
|
||||||
if (!def) continue;
|
if (!def) continue;
|
||||||
|
|
||||||
var param = node.params[i];
|
var param = node.params[i];
|
||||||
@ -40,8 +38,8 @@ exports.Function = function (node, parent, file, scope) {
|
|||||||
// temporal dead zone check - here we prevent accessing of params that
|
// temporal dead zone check - here we prevent accessing of params that
|
||||||
// are to the right - ie. uninitialized parameters
|
// are to the right - ie. uninitialized parameters
|
||||||
var rightIds = ids.slice(i);
|
var rightIds = ids.slice(i);
|
||||||
for (i = 0; i < rightIds.length; i++) {
|
for (var i2 = 0; i2 < rightIds.length; i2++) {
|
||||||
checkTDZ(rightIds[i]);
|
checkTDZ(rightIds[i2]);
|
||||||
}
|
}
|
||||||
|
|
||||||
// we're accessing a variable that's already defined within this function
|
// we're accessing a variable that's already defined within this function
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user