1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

js: fix code generation for $if js statements (#6896)

This commit is contained in:
pancake 2020-11-21 15:40:37 +01:00 committed by GitHub
parent 54df7d1daf
commit 4b19a6e00d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1270,7 +1270,11 @@ fn (mut g JsGen) gen_if_expr(node ast.IfExpr) {
}
else {
g.write('if (')
g.expr(branch.cond)
if '$branch.cond' == 'js' {
g.write('true')
} else {
g.expr(branch.cond)
}
g.writeln(') {')
}
}