cgen: add () for | and ^
parent
50dabc8a49
commit
804d303487
|
@ -121,7 +121,7 @@ fn parse_args(args []string) (&pref.Preferences, string) {
|
|||
res.out_name = cmdline.option(args, '-o', '')
|
||||
i++
|
||||
}
|
||||
'-csource' {
|
||||
'-csource', 'backend' {
|
||||
i++ // TODO
|
||||
}
|
||||
else {
|
||||
|
|
|
@ -1382,7 +1382,7 @@ fn (g mut Gen) infix_expr(node ast.InfixExpr) {
|
|||
}
|
||||
}
|
||||
else {
|
||||
need_par := node.op == .amp // `x & y == 0` => `(x & y) == 0` in C
|
||||
need_par := node.op in [.amp, .pipe, .xor] // `x & y == 0` => `(x & y) == 0` in C
|
||||
if need_par {
|
||||
g.write('(')
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue