diff options
-rw-r--r-- | compiler/jsgen.nim | 1 | ||||
-rw-r--r-- | tests/js/treprinifexpr.nim | 18 |
2 files changed, 19 insertions, 0 deletions
diff --git a/compiler/jsgen.nim b/compiler/jsgen.nim index 766e6a80d..cd14f1cf9 100644 --- a/compiler/jsgen.nim +++ b/compiler/jsgen.nim @@ -1927,6 +1927,7 @@ proc genRepr(p: PProc, n: PNode, r: var TCompRes) = genReprAux(p, n, r, "reprJSONStringify") else: genReprAux(p, n, r, "reprAny", genTypeInfo(p, t)) + r.kind = resExpr proc genOf(p: PProc, n: PNode, r: var TCompRes) = var x: TCompRes diff --git a/tests/js/treprinifexpr.nim b/tests/js/treprinifexpr.nim new file mode 100644 index 000000000..09ded18b9 --- /dev/null +++ b/tests/js/treprinifexpr.nim @@ -0,0 +1,18 @@ +type + Enum = enum A + +let + enumVal = A + tmp = if true: $enumVal else: $enumVal + +let + intVal = 12 + tmp2 = if true: repr(intVal) else: $enumVal + +let + strVal = "123" + tmp3 = if true: repr(strVal) else: $strVal + +let + floatVal = 12.4 + tmp4 = if true: repr(floatVal) else: $floatVal \ No newline at end of file |