Cleanup and fix isConstExpr to return true for all atomic node types.
This commit is contained in:
parent
c23a3e1f84
commit
defc7bbded
1 changed files with 2 additions and 4 deletions
|
|
@ -81,10 +81,8 @@ proc getMagic*(op: PNode): TMagic =
|
||||||
else: result = mNone
|
else: result = mNone
|
||||||
|
|
||||||
proc isConstExpr*(n: PNode): bool =
|
proc isConstExpr*(n: PNode): bool =
|
||||||
const constKinds = {nkCharLit..nkInt64Lit, nkStrLit..nkTripleStrLit, nkFloatLit..nkFloat64Lit, nkNilLit}
|
const atomKinds = {nkCharLit..nkNilLit} # Char, Int, UInt, Str, Float and Nil literals
|
||||||
result = (n.kind in
|
n.kind in atomKinds or nfAllConst in n.flags
|
||||||
{nkCharLit..nkInt64Lit, nkStrLit..nkTripleStrLit,
|
|
||||||
nkFloatLit..nkFloat64Lit, nkNilLit}) or (nfAllConst in n.flags)
|
|
||||||
|
|
||||||
proc isCaseObj*(n: PNode): bool =
|
proc isCaseObj*(n: PNode): bool =
|
||||||
if n.kind == nkRecCase: return true
|
if n.kind == nkRecCase: return true
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue