mirror of
https://github.com/github/codeql.git
synced 2026-04-30 19:26:02 +02:00
JavaScript: Accept let expressions with an object literal as their body.
This commit is contained in:
@@ -196,8 +196,12 @@ public class CustomParser extends FlowParser {
|
||||
this.expect(TokenType.parenR);
|
||||
|
||||
if (this.type == TokenType.braceL) {
|
||||
if (!maybeStatement)
|
||||
this.unexpected();
|
||||
if (!maybeStatement) {
|
||||
// must be the start of an object literal
|
||||
Expression body = this.parseObj(false, null);
|
||||
return this.finishNode(new LetExpression(new SourceLocation(startLoc), decl.getDeclarations(), body));
|
||||
}
|
||||
|
||||
BlockStatement body = this.parseBlock(false);
|
||||
return this.finishNode(new LetStatement(new SourceLocation(startLoc), decl.getDeclarations(), body));
|
||||
} else if (maybeStatement) {
|
||||
|
||||
@@ -2,4 +2,6 @@ var x = 42, y = 19;
|
||||
|
||||
console.log(let (x = 23, y = 19) x + y);
|
||||
|
||||
console.log(x - y);
|
||||
console.log(x - y);
|
||||
|
||||
JSON.stringify(let (x = 23, y = 19) { x: x, y: y});
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user