parent
801eb3cb56
commit
5d947bb791
1 changed files with 7 additions and 5 deletions
|
|
@ -315,17 +315,19 @@ proc useMagic(p: PProc, name: string) =
|
||||||
|
|
||||||
proc isSimpleExpr(p: PProc; n: PNode): bool =
|
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
|
||||||
if n.kind in nkCallKinds+{nkBracketExpr, nkDotExpr, nkPar, nkTupleConstr} or
|
case n.kind
|
||||||
(n.kind in {nkObjConstr, nkBracket, nkCurly}):
|
of nkCallKinds, nkBracketExpr, nkDotExpr, nkPar, nkTupleConstr,
|
||||||
|
nkObjConstr, nkBracket, nkCurly:
|
||||||
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
|
||||||
elif n.kind == nkStmtListExpr:
|
of nkStmtListExpr:
|
||||||
for i in 0..<n.len-1:
|
for i in 0..<n.len-1:
|
||||||
if n[i].kind notin {nkCommentStmt, nkEmpty}: return false
|
if n[i].kind notin {nkCommentStmt, nkEmpty}: return false
|
||||||
result = isSimpleExpr(p, n.lastSon)
|
result = isSimpleExpr(p, n.lastSon)
|
||||||
elif n.isAtom:
|
else:
|
||||||
result = true
|
if n.isAtom:
|
||||||
|
result = true
|
||||||
|
|
||||||
proc getTemp(p: PProc, defineInLocals: bool = true): Rope =
|
proc getTemp(p: PProc, defineInLocals: bool = true): Rope =
|
||||||
inc(p.unique)
|
inc(p.unique)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue