mirror of
https://github.com/fluencelabs/assemblyscript
synced 2025-06-10 21:41:25 +00:00
Fix arrow function body parsing precedence (#546)
This commit is contained in:
@ -1437,9 +1437,14 @@ export class Parser extends DiagnosticEmitter {
|
|||||||
tn.range(signatureStart, tn.pos)
|
tn.range(signatureStart, tn.pos)
|
||||||
);
|
);
|
||||||
|
|
||||||
var body: Statement | null;
|
var body: Statement | null = null;
|
||||||
if (arrowKind) {
|
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 {
|
} else {
|
||||||
if (!tn.skip(Token.OPENBRACE)) {
|
if (!tn.skip(Token.OPENBRACE)) {
|
||||||
this.error(
|
this.error(
|
||||||
|
Reference in New Issue
Block a user