fix default parameters transformer for loops

This commit is contained in:
Sebastian McKenzie 2015-01-16 02:36:56 +11:00
parent 51c6a3fffc
commit a01802300f

View File

@ -11,8 +11,6 @@ exports.Function = function (node, parent, file, scope) {
});
var iife = false;
var i;
var def;
var checkTDZ = function (ids) {
var check = function (node, parent) {
@ -31,8 +29,8 @@ exports.Function = function (node, parent, file, scope) {
traverse(def, { enter: check });
};
for (i = 0; i < node.defaults.length; i++) {
def = node.defaults[i];
for (var i = 0; i < node.defaults.length; i++) {
var def = node.defaults[i];
if (!def) continue;
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
// are to the right - ie. uninitialized parameters
var rightIds = ids.slice(i);
for (i = 0; i < rightIds.length; i++) {
checkTDZ(rightIds[i]);
for (var i2 = 0; i2 < rightIds.length; i2++) {
checkTDZ(rightIds[i2]);
}
// we're accessing a variable that's already defined within this function