jsgen: bool genConv generates boolean values instead of numeric (#7016)

This commit is contained in:
qqquinta 2018-01-03 13:40:19 +02:00 • committed by Andreas Rumpf
commit d5f539dc87

View file

@ -2051,10 +2051,10 @@ proc genConv(p: PProc, n: PNode, r: var TCompRes) =
return return
case dest.kind: case dest.kind:
of tyBool: of tyBool:
r.res = "(($1)? 1:0)" % [r.res] r.res = "(!!($1))" % [r.res]
r.kind = resExpr r.kind = resExpr
of tyInt: of tyInt:
r.res = "($1|0)" % [r.res] r.res = "(($1)|0)" % [r.res]
else: else:
# TODO: What types must we handle here? # TODO: What types must we handle here?
discard discard