0 issues 1 contributor 4 branches 0 releases
Additions: 17 Deletions: 0 View patch
1 }
2 }
3 }
4+ if expr is ast.IndexExpr {
5+ if expr.or_expr.kind != .absent {
6+ return true
7+ }
8+ if g.need_tmp_var_in_expr(expr.index) {
9+ return true
10+ }
11+ }
12 return false
13 }
14
15
1new file mode 100644
2+import rand
3+
4+fn test_if_expr_with_index_expr() {
5+ a := [1, 2, 3]
6+
7+ b := if true { a[rand.intn(a.len) or { 0 }] } else { 0 }
8+ println(b)
9+ assert true
10+}
11