Correct the validator for ArrayPattern (#5722)
The elements of the `elements` array should be either `Identifier`, `Pattern` or `RestElement`, but the validator was requiring `Expression`. It happened to work for `Identifier` since an `Identifier` is an `Expression`, but not for the other possible pattern elements.
This commit is contained in:
parent
5633e3c4f6
commit
899a754bef
@ -29,7 +29,7 @@ defineType("ArrayPattern", {
|
||||
aliases: ["Pattern", "LVal"],
|
||||
fields: {
|
||||
elements: {
|
||||
validate: chain(assertValueType("array"), assertEach(assertNodeType("Expression"))),
|
||||
validate: chain(assertValueType("array"), assertEach(assertNodeType("Identifier", "Pattern", "RestElement"))),
|
||||
},
|
||||
decorators: {
|
||||
validate: chain(assertValueType("array"), assertEach(assertNodeType("Decorator"))),
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user