@@ -62,15 +62,15 @@ const (
62
62
OperatorPrecedenceLogicalAND
63
63
// BitwiseORExpression:
64
64
// BitwiseXORExpression
65
- // BitwiseORExpression `^ ` BitwiseXORExpression
65
+ // BitwiseORExpression `| ` BitwiseXORExpression
66
66
OperatorPrecedenceBitwiseOR
67
67
// BitwiseXORExpression:
68
68
// BitwiseANDExpression
69
69
// BitwiseXORExpression `^` BitwiseANDExpression
70
70
OperatorPrecedenceBitwiseXOR
71
71
// BitwiseANDExpression:
72
72
// EqualityExpression
73
- // BitwiseANDExpression `^ ` EqualityExpression
73
+ // BitwiseANDExpression `& ` EqualityExpression
74
74
OperatorPrecedenceBitwiseAND
75
75
// EqualityExpression:
76
76
// RelationalExpression
@@ -174,10 +174,12 @@ const (
174
174
// AsyncGeneratorExpression
175
175
// RegularExpressionLiteral
176
176
// TemplateLiteral
177
- // CoverParenthesizedExpressionAndArrowParameterList
178
177
OperatorPrecedencePrimary
178
+ // PrimaryExpression:
179
+ // CoverParenthesizedExpressionAndArrowParameterList
180
+ OperatorPrecedenceParentheses
179
181
OperatorPrecedenceLowest = OperatorPrecedenceComma
180
- OperatorPrecedenceHighest = OperatorPrecedencePrimary
182
+ OperatorPrecedenceHighest = OperatorPrecedenceParentheses
181
183
OperatorPrecedenceDisallowComma = OperatorPrecedenceYield
182
184
// -1 is lower than all other precedences. Returning it will cause binary expression
183
185
// parsing to stop.
@@ -316,13 +318,16 @@ func GetOperatorPrecedence(nodeKind Kind, operatorKind Kind, flags OperatorPrece
316
318
KindRegularExpressionLiteral ,
317
319
KindNoSubstitutionTemplateLiteral ,
318
320
KindTemplateExpression ,
319
- KindParenthesizedExpression ,
320
321
KindOmittedExpression ,
321
322
KindJsxElement ,
322
323
KindJsxSelfClosingElement ,
323
324
KindJsxFragment :
324
325
return OperatorPrecedencePrimary
325
326
327
+ // !!! By necessity, this differs from the old compiler to support emit. consider backporting
328
+ case KindParenthesizedExpression :
329
+ return OperatorPrecedenceParentheses
330
+
326
331
default :
327
332
return OperatorPrecedenceInvalid
328
333
}
0 commit comments