From 86f7bd5a7c7d85e6f292c04c8b658665fcf475f3 Mon Sep 17 00:00:00 2001 From: rimuy <46044567+rimuy@users.noreply.github.com> Date: Wed, 7 Feb 2024 15:40:55 -0300 Subject: [PATCH] Add floor division operators (#424) --- src/LuauAST/types/operators.ts | 3 ++- src/LuauRenderer/util/needsParentheses.ts | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/LuauAST/types/operators.ts b/src/LuauAST/types/operators.ts index 74cc513..2958798 100644 --- a/src/LuauAST/types/operators.ts +++ b/src/LuauAST/types/operators.ts @@ -3,6 +3,7 @@ export type BinaryOperator = | "-" | "*" | "/" + | "//" | "^" | "%" | ".." @@ -17,4 +18,4 @@ export type BinaryOperator = export type UnaryOperator = "-" | "not" | "#"; -export type AssignmentOperator = "=" | "+=" | "-=" | "*=" | "/=" | "%=" | "^=" | "..="; +export type AssignmentOperator = "=" | "+=" | "-=" | "*=" | "/=" | "//=" | "%=" | "^=" | "..="; diff --git a/src/LuauRenderer/util/needsParentheses.ts b/src/LuauRenderer/util/needsParentheses.ts index 5e9fb94..36d609a 100644 --- a/src/LuauRenderer/util/needsParentheses.ts +++ b/src/LuauRenderer/util/needsParentheses.ts @@ -35,6 +35,7 @@ const BINARY_OPERATOR_PRECEDENCE: { [K in luau.BinaryOperator]: number } = { "-": 5, "*": 6, "/": 6, + "//": 6, "%": 6, "^": 8, };