From d3af2fcd8096401b5618a7e479bfb5b25e129eed Mon Sep 17 00:00:00 2001 From: David Bonnet Date: Wed, 3 Feb 2021 13:59:32 +0100 Subject: [PATCH] fix: lower yield operator precedence --- src/astring.js | 2 +- src/tests/fixtures/syntax/precedence.js | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/astring.js b/src/astring.js index d1bce28c..3fd28d40 100644 --- a/src/astring.js +++ b/src/astring.js @@ -80,11 +80,11 @@ export const EXPRESSIONS_PRECEDENCE = { UpdateExpression: 16, UnaryExpression: 15, AwaitExpression: 15, - YieldExpression: 15, BinaryExpression: 14, LogicalExpression: 13, ConditionalExpression: 4, AssignmentExpression: 3, + YieldExpression: 2, RestElement: 1, } diff --git a/src/tests/fixtures/syntax/precedence.js b/src/tests/fixtures/syntax/precedence.js index 17bce5f2..79c205c2 100644 --- a/src/tests/fixtures/syntax/precedence.js +++ b/src/tests/fixtures/syntax/precedence.js @@ -46,5 +46,7 @@ g = b + -+-a++; await f().a; yield 1; yield 1 + 2; + (yield 1) + (yield 2); + yield a = b; const c = yield 3; });