Destructuring vardef in for..of and for..in
This commit is contained in:
committed by
Richard van Velzen
parent
e99bc914ca
commit
d4f17f29ae
@@ -1187,7 +1187,7 @@ function parse($TEXT, options) {
|
||||
def = new AST_VarDef({
|
||||
start: S.token,
|
||||
name: destructuring_(sym_type),
|
||||
value: (expect_token("operator", "="), expression(false, no_in)),
|
||||
value: is("operator", "=") ? (expect_token("operator", "="), expression(false, no_in)) : null,
|
||||
end: prev()
|
||||
});
|
||||
} else {
|
||||
|
||||
@@ -23,3 +23,12 @@ nested_destructuring_objects: {
|
||||
}
|
||||
expect_exact: 'var[{a},b]=c;';
|
||||
}
|
||||
|
||||
destructuring_vardef_in_loops: {
|
||||
input: {
|
||||
for (var [x,y] in pairs);
|
||||
for (var [a] = 0;;);
|
||||
for (var {c} of cees);
|
||||
}
|
||||
expect_exact: "for(var[x,y]in pairs);for(var[a]=0;;);for(var{c}of cees);"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user