cgen: add () for | and ^

pull/4205/head
Alexander Medvednikov 2020-04-02 18:26:56 +02:00
parent 50dabc8a49
commit 804d303487
2 changed files with 2 additions and 2 deletions

View File

@ -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 {

View File

@ -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('(')
}