JavaScript: Add support for for-each-in comprehensions.

This commit is contained in:
Max Schaefer
2019-01-29 15:54:01 +00:00
parent d3ae2954ff
commit 88be67a4fc
5 changed files with 1356 additions and 1099 deletions

View File

@@ -274,16 +274,17 @@ public class CustomParser extends FlowParser {
List<ComprehensionBlock> blocks = new ArrayList<ComprehensionBlock>();
while (this.type == TokenType._for) {
SourceLocation blockStart = new SourceLocation(this.startLoc);
boolean of = false;
this.next();
if (this.eatContextual("each"))
of = true;
this.expect(TokenType.parenL);
Expression left = this.parseBindingAtom();
this.checkLVal(left, true, null);
boolean of;
if (this.eatContextual("of")) {
of = true;
} else {
this.expect(TokenType._in);
of = false;
}
Expression right = this.parseExpression(false, null);
this.expect(TokenType.parenR);