suffix unary operators (++, --) working as intended
This commit is contained in:
10
generator.v
10
generator.v
@@ -179,7 +179,15 @@ fn (mut g Generator) gen_expr(expr Expr) {
|
||||
g.out.write_string(mangle_var(expr.name))
|
||||
}
|
||||
UnaryExpr {
|
||||
g.out.write_string('(${mangle_var(expr.ident)}${expr.op})')
|
||||
if expr.op_on_left {
|
||||
g.out.write_string('(${expr.op}')
|
||||
g.gen_expr(expr.expr)
|
||||
g.out.write_string(')')
|
||||
} else {
|
||||
g.out.write_string('(')
|
||||
g.gen_expr(expr.expr)
|
||||
g.out.write_string('${expr.op})')
|
||||
}
|
||||
}
|
||||
BinaryExpr {
|
||||
g.out.write_string('(')
|
||||
|
||||
Reference in New Issue
Block a user