Browse Source

fix: missing nested expression braces

github-actions
Garrit Franke 3 years ago
parent
commit
78650f7f42
  1. 1
      TODO
  2. 8
      examples/playground.sb
  3. 2
      src/generator/js.rs

1
TODO

@ -1,5 +1,4 @@
# Bugs
- Generated nested expressions should include braces
# Cleanups
- Improve error reporting (See ./util/string_util::highlight_position_in_file)

8
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)
}

2
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)

Loading…
Cancel
Save