mirror of
https://github.com/nim-lang/Nim.git
synced 2026-04-18 13:30:33 +00:00
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 <Varriount@users.noreply.github.com>
This commit is contained in:
committed by
GitHub
parent
d755c02b02
commit
98a717dda9
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user