parent
f8174c381c
commit
e1c762a616
|
@ -14,9 +14,17 @@ fn (mut g Gen) gen_assert_stmt(original_assert_statement ast.AssertStmt) {
|
||||||
if mut node.expr is ast.InfixExpr {
|
if mut node.expr is ast.InfixExpr {
|
||||||
if mut node.expr.left is ast.CallExpr {
|
if mut node.expr.left is ast.CallExpr {
|
||||||
node.expr.left = g.new_ctemp_var_then_gen(node.expr.left, node.expr.left_type)
|
node.expr.left = g.new_ctemp_var_then_gen(node.expr.left, node.expr.left_type)
|
||||||
|
} else if mut node.expr.left is ast.ParExpr {
|
||||||
|
if node.expr.left.expr is ast.CallExpr {
|
||||||
|
node.expr.left = g.new_ctemp_var_then_gen(node.expr.left.expr, node.expr.left_type)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if mut node.expr.right is ast.CallExpr {
|
if mut node.expr.right is ast.CallExpr {
|
||||||
node.expr.right = g.new_ctemp_var_then_gen(node.expr.right, node.expr.right_type)
|
node.expr.right = g.new_ctemp_var_then_gen(node.expr.right, node.expr.right_type)
|
||||||
|
} else if mut node.expr.right is ast.ParExpr {
|
||||||
|
if node.expr.right.expr is ast.CallExpr {
|
||||||
|
node.expr.right = g.new_ctemp_var_then_gen(node.expr.right.expr, node.expr.right_type)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
g.inside_ternary++
|
g.inside_ternary++
|
||||||
|
|
|
@ -0,0 +1,7 @@
|
||||||
|
fn foo(fail bool) ?string {
|
||||||
|
return if fail { error('failure') } else { 'success' }
|
||||||
|
}
|
||||||
|
|
||||||
|
fn test_assert_fn_call_with_parentheses() {
|
||||||
|
assert (foo(true) or { '' }) == ''
|
||||||
|
}
|
Loading…
Reference in New Issue