mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
cgen: add () for | and ^
This commit is contained in:
@@ -121,7 +121,7 @@ fn parse_args(args []string) (&pref.Preferences, string) {
|
|||||||
res.out_name = cmdline.option(args, '-o', '')
|
res.out_name = cmdline.option(args, '-o', '')
|
||||||
i++
|
i++
|
||||||
}
|
}
|
||||||
'-csource' {
|
'-csource', 'backend' {
|
||||||
i++ // TODO
|
i++ // TODO
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
@@ -1382,7 +1382,7 @@ fn (g mut Gen) infix_expr(node ast.InfixExpr) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
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 {
|
if need_par {
|
||||||
g.write('(')
|
g.write('(')
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user