Guard against missing elements in array patterns when checking function parameters.
This commit is contained in:
parent
bdee9e8195
commit
e9c7209f8b
6
acorn.js
6
acorn.js
@ -1391,8 +1391,10 @@
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case "ArrayPattern":
|
case "ArrayPattern":
|
||||||
for (var i = 0; i < param.elements.length; i++)
|
for (var i = 0; i < param.elements.length; i++) {
|
||||||
checkFunctionParam(param.elements[i], nameHash);
|
var elem = param.elements[i];
|
||||||
|
if (elem) checkFunctionParam(elem, nameHash);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -15389,3 +15389,5 @@ test('function normal(x, y = 10) {}', {
|
|||||||
expression: false
|
expression: false
|
||||||
}]
|
}]
|
||||||
}, {ecmaVersion: 6});
|
}, {ecmaVersion: 6});
|
||||||
|
|
||||||
|
test("'use strict'; function f([x,,z]) {}", {}, {ecmaVersion: 6});
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user