diff options
author | Matthew Baulch <baulch.matt@gmail.com> | 2016-08-27 21:09:05 +1000 |
---|---|---|
committer | Matthew Baulch <baulch.matt@gmail.com> | 2016-08-27 21:09:05 +1000 |
commit | defc7bbded2b38a45c0602f97e44fe702f8c5f0b (patch) | |
tree | 8e1cac21255c62cdae0f1f19ea26fedab2198923 | |
parent | c23a3e1f840285c8e76f0cad379fc52ac59188f9 (diff) | |
download | Nim-defc7bbded2b38a45c0602f97e44fe702f8c5f0b.tar.gz |
Cleanup and fix isConstExpr to return true for all atomic node types.
-rw-r--r-- | compiler/trees.nim | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/compiler/trees.nim b/compiler/trees.nim index f2d417f72..a629b3834 100644 --- a/compiler/trees.nim +++ b/compiler/trees.nim @@ -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 |