mirror of
https://github.com/fluencelabs/assemblyscript
synced 2025-04-25 07:02:13 +00:00
Fix arrow function body parsing precedence (#546)
This commit is contained in:
parent
fd99589527
commit
858cca5a38
@ -1437,9 +1437,14 @@ export class Parser extends DiagnosticEmitter {
|
||||
tn.range(signatureStart, tn.pos)
|
||||
);
|
||||
|
||||
var body: Statement | null;
|
||||
var body: Statement | null = null;
|
||||
if (arrowKind) {
|
||||
body = this.parseStatement(tn, false);
|
||||
if (tn.skip(Token.OPENBRACE)) {
|
||||
body = this.parseBlockStatement(tn, false);
|
||||
} else {
|
||||
let bodyExpression = this.parseExpression(tn, Precedence.COMMA + 1);
|
||||
if (bodyExpression) body = Node.createExpressionStatement(bodyExpression);
|
||||
}
|
||||
} else {
|
||||
if (!tn.skip(Token.OPENBRACE)) {
|
||||
this.error(
|
||||
|
Loading…
x
Reference in New Issue
Block a user