From defc7bbded2b38a45c0602f97e44fe702f8c5f0b Mon Sep 17 00:00:00 2001 From: Matthew Baulch Date: Sat, 27 Aug 2016 21:09:05 +1000 Subject: [PATCH] Cleanup and fix isConstExpr to return true for all atomic node types. --- compiler/trees.nim | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/compiler/trees.nim b/compiler/trees.nim index f2d417f72e..a629b38341 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