Cleanup and fix isConstExpr to return true for all atomic node types.

This commit is contained in:
Matthew Baulch
2016-08-27 21:09:05 +10:00
parent c23a3e1f84
commit defc7bbded

View File

@@ -81,10 +81,8 @@ proc getMagic*(op: PNode): TMagic =
else: result = mNone
proc isConstExpr*(n: PNode): bool =
const constKinds = {nkCharLit..nkInt64Lit, nkStrLit..nkTripleStrLit, nkFloatLit..nkFloat64Lit, nkNilLit}
result = (n.kind in
{nkCharLit..nkInt64Lit, nkStrLit..nkTripleStrLit,
nkFloatLit..nkFloat64Lit, nkNilLit}) or (nfAllConst in n.flags)
const atomKinds = {nkCharLit..nkNilLit} # Char, Int, UInt, Str, Float and Nil literals
n.kind in atomKinds or nfAllConst in n.flags
proc isCaseObj*(n: PNode): bool =
if n.kind == nkRecCase: return true