From 98a717dda92ff45dc14818815ddc53764339066b Mon Sep 17 00:00:00 2001 From: Amjad Ben Hedhili Date: Tue, 27 Sep 2022 11:47:45 +0100 Subject: [PATCH] allow more simple expressions in js (#20270) * make it match ccgexprs.nim `isSimpleExpr` * x in {1, 2} * r[].x and r.x when r is ref type * float(x) Co-authored-by: Clay Sweetser --- compiler/jsgen.nim | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/compiler/jsgen.nim b/compiler/jsgen.nim index cf2a570e3..dc58efb82 100644 --- a/compiler/jsgen.nim +++ b/compiler/jsgen.nim @@ -330,7 +330,9 @@ proc isSimpleExpr(p: PProc; n: PNode): bool = # calls all the way down --> can stay expression based case n.kind of nkCallKinds, nkBracketExpr, nkDotExpr, nkPar, nkTupleConstr, - nkObjConstr, nkBracket, nkCurly: + nkObjConstr, nkBracket, nkCurly, + nkDerefExpr, nkHiddenDeref, nkAddr, nkHiddenAddr, + nkConv, nkHiddenStdConv, nkHiddenSubConv: for c in n: if not p.isSimpleExpr(c): return false result = true