Don't crash when converting missing array elements to assignable

Closes #220
This commit is contained in:
Marijn Haverbeke
2015-03-19 12:56:19 +01:00
parent b6e8310848
commit 5d5b8eb3c8
2 changed files with 44 additions and 17 deletions

View File

@@ -15466,6 +15466,34 @@ test("let {x} = y", {
"end": 11
}, {ecmaVersion: 6})
test("[x,,] = 1", {
type: "Program",
body: [
{
type: "ExpressionStatement",
expression: {
type: "AssignmentExpression",
operator: "=",
left: {
type: "ArrayPattern",
elements: [
{
type: "Identifier",
name: "x"
},
null
]
},
right: {
type: "Literal",
value: 1,
raw: "1"
}
}
}
]
}, {ecmaVersion: 6});
testFail("let [x]", "Complex binding patterns require an initialization value (1:7)", {ecmaVersion: 6})
testFail("var [x]", "Complex binding patterns require an initialization value (1:7)", {ecmaVersion: 6})
testFail("var _𖫵 = 11;", "Unexpected character '𖫵' (1:5)", {ecmaVersion: 6});