Guard against missing elements in array patterns when checking function parameters.

This commit is contained in:
Max Schaefer 2014-10-09 13:52:08 +01:00 committed by Marijn Haverbeke
parent bdee9e8195
commit e9c7209f8b
2 changed files with 6 additions and 2 deletions

View File

@ -1391,8 +1391,10 @@
break;
case "ArrayPattern":
for (var i = 0; i < param.elements.length; i++)
checkFunctionParam(param.elements[i], nameHash);
for (var i = 0; i < param.elements.length; i++) {
var elem = param.elements[i];
if (elem) checkFunctionParam(elem, nameHash);
}
break;
}
}

View File

@ -15389,3 +15389,5 @@ test('function normal(x, y = 10) {}', {
expression: false
}]
}, {ecmaVersion: 6});
test("'use strict'; function f([x,,z]) {}", {}, {ecmaVersion: 6});