diff --git a/TODO b/TODO index 421c57d..549a8bc 100644 --- a/TODO +++ b/TODO @@ -1,5 +1,4 @@ # Bugs -- Generated nested expressions should include braces # Cleanups - Improve error reporting (See ./util/string_util::highlight_position_in_file) diff --git a/examples/playground.sb b/examples/playground.sb index d096418..1c6dd5b 100644 --- a/examples/playground.sb +++ b/examples/playground.sb @@ -1,9 +1,5 @@ fn main() { - let arr = [[11, 12, 13], [21, 22, 23], [31, 32, 33]] - for i in arr { - for j in i { - println(j) - } - } + let x = (1 + (2 * 3)) + print(x) } \ No newline at end of file diff --git a/src/generator/js.rs b/src/generator/js.rs index bf78fc6..5fc5f41 100644 --- a/src/generator/js.rs +++ b/src/generator/js.rs @@ -244,7 +244,7 @@ fn generate_bin_op(left: Expression, op: BinOp, right: Expression) -> String { BinOp::Subtraction => "-", }; format!( - "{l} {op} {r}", + "({l} {op} {r})", l = generate_expression(left), op = op_str, r = generate_expression(right)