Skip to content

Commit 4a00f4b

Browse files
authored
fix BinaryExpr (#147)
1 parent de5ad45 commit 4a00f4b

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

expr.v

+4-3
Original file line numberDiff line numberDiff line change
@@ -123,11 +123,12 @@ fn (mut app App) binary_expr(b BinaryExpr) {
123123
app.gen('${x.value}${b.op}${y.value}')
124124
} else if x is BasicLit && y is Ident {
125125
app.gen("'${x.value[1..x.value.len - 1]}\${${y.name}}'")
126-
} else if x is Ident && y is BasicLit {
126+
} else if x is Ident && y is BasicLit && y.kind == 'STRING' {
127127
app.gen("'\${${x.name}}${y.value[1..y.value.len - 1]}'")
128128
} else {
129-
eprintln('Unknown BinaryExpr')
130-
dump(b)
129+
app.expr(x)
130+
app.gen('+')
131+
app.expr(y)
131132
}
132133
} else {
133134
app.expr(b.x)

0 commit comments

Comments
 (0)