fix bitwise precedence

This commit is contained in:
Chris Wanstrath 2025-11-25 15:51:45 -08:00 committed by Chris Wanstrath
parent d003d65a15
commit 6a6675d30f

View File

@ -380,23 +380,25 @@ export const precedence: Record<string, number> = {
// Nullish coalescing
'??': 35,
// Bitwise shifts (lower precedence than addition)
'<<': 37,
'>>': 37,
'>>>': 37,
// Addition/Subtraction
'+': 40,
'-': 40,
// Bitwise AND/OR/XOR (higher precedence than addition)
'band': 45,
'bor': 45,
'bxor': 45,
// Multiplication/Division/Modulo
'*': 50,
'/': 50,
'%': 50,
// Bitwise
'band': 45,
'bor': 45,
'bxor': 45,
'<<': 45,
'>>': 45,
'>>>': 45,
// Exponentiation (right-associative)
'**': 60,
}