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:
parent
d755c02b02
commit
98a717dda9
1 changed files with 3 additions and 1 deletions
|
|
@ -330,7 +330,9 @@ proc isSimpleExpr(p: PProc; n: PNode): bool =
|
||||||
# calls all the way down --> can stay expression based
|
# calls all the way down --> can stay expression based
|
||||||
case n.kind
|
case n.kind
|
||||||
of nkCallKinds, nkBracketExpr, nkDotExpr, nkPar, nkTupleConstr,
|
of nkCallKinds, nkBracketExpr, nkDotExpr, nkPar, nkTupleConstr,
|
||||||
nkObjConstr, nkBracket, nkCurly:
|
nkObjConstr, nkBracket, nkCurly,
|
||||||
|
nkDerefExpr, nkHiddenDeref, nkAddr, nkHiddenAddr,
|
||||||
|
nkConv, nkHiddenStdConv, nkHiddenSubConv:
|
||||||
for c in n:
|
for c in n:
|
||||||
if not p.isSimpleExpr(c): return false
|
if not p.isSimpleExpr(c): return false
|
||||||
result = true
|
result = true
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue