summary refs log tree commit diff stats
path: root/compiler
diff options
context:
space:
mode:
authorOscar NihlgÄrd <oscarnihlgard@gmail.com>2020-04-13 14:22:33 +0200
committerGitHub <noreply@github.com>2020-04-13 14:22:33 +0200
commit255698deee403ae80b26baa567043a07dc3c7404 (patch)
treeb9e8ddfe32e600bd81c51e9812ae22b0323bfaff /compiler
parent40b64ccd7b2d6c42ebe3c3ad1e7fdfa3fa7a00dd (diff)
downloadNim-255698deee403ae80b26baa567043a07dc3c7404.tar.gz
Fix semfold handling of {.str/int/bool-define.} (#13964)
Diffstat (limited to 'compiler')
-rw-r--r--compiler/semfold.nim6
1 files changed, 6 insertions, 0 deletions
diff --git a/compiler/semfold.nim b/compiler/semfold.nim
index f0971bf09..5e2c2bccc 100644
--- a/compiler/semfold.nim
+++ b/compiler/semfold.nim
@@ -549,9 +549,13 @@ proc getConstExpr(m: PSym, n: PNode; g: ModuleGraph): PNode =
             localError(g.config, s.info,
               "{.intdefine.} const was set to an invalid integer: '" &
                 g.config.symbols[s.name.s] & "'")
+        else:
+          result = copyTree(s.ast)
       of mStrDefine:
         if isDefined(g.config, s.name.s):
           result = newStrNodeT(g.config.symbols[s.name.s], n, g)
+        else:
+          result = copyTree(s.ast)
       of mBoolDefine:
         if isDefined(g.config, s.name.s):
           try:
@@ -560,6 +564,8 @@ proc getConstExpr(m: PSym, n: PNode; g: ModuleGraph): PNode =
             localError(g.config, s.info,
               "{.booldefine.} const was set to an invalid bool: '" &
                 g.config.symbols[s.name.s] & "'")
+        else:
+          result = copyTree(s.ast)
       else:
         result = copyTree(s.ast)
     of skProc, skFunc, skMethod: