diff options
author | Oscar NihlgÄrd <oscarnihlgard@gmail.com> | 2020-04-13 14:22:33 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-04-13 14:22:33 +0200 |
commit | 255698deee403ae80b26baa567043a07dc3c7404 (patch) | |
tree | b9e8ddfe32e600bd81c51e9812ae22b0323bfaff /compiler | |
parent | 40b64ccd7b2d6c42ebe3c3ad1e7fdfa3fa7a00dd (diff) | |
download | Nim-255698deee403ae80b26baa567043a07dc3c7404.tar.gz |
Fix semfold handling of {.str/int/bool-define.} (#13964)
Diffstat (limited to 'compiler')
-rw-r--r-- | compiler/semfold.nim | 6 |
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: |