From d80f1633844597f3a8020fc156d2d889bf897d97 Mon Sep 17 00:00:00 2001 From: Araq Date: Wed, 30 Sep 2015 11:02:23 +0200 Subject: [PATCH] NimScript: --define works as expected --- compiler/scriptconfig.nim | 5 ++++- tests/newconfig/tfoo.nim | 3 +++ tests/newconfig/tfoo.nims | 1 + 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/compiler/scriptconfig.nim b/compiler/scriptconfig.nim index aaa2486e5d..22cd282fda 100644 --- a/compiler/scriptconfig.nim +++ b/compiler/scriptconfig.nim @@ -140,4 +140,7 @@ proc runNimScript*(scriptName: string) = # ensure we load 'system.nim' again for the real non-config stuff! resetAllModulesHard() vm.globalCtx = nil - initDefines() + # do not remove the defined symbols + #initDefines() + undefSymbol("nimscript") + undefSymbol("nimconfig") diff --git a/tests/newconfig/tfoo.nim b/tests/newconfig/tfoo.nim index 0ace7c88a7..d593d4a756 100644 --- a/tests/newconfig/tfoo.nim +++ b/tests/newconfig/tfoo.nim @@ -4,4 +4,7 @@ discard """ msg: '''[NimScript] exec: gcc -v''' """ +when not defined(definedefine): + {.fatal: "wrong nim script configuration".} + echo "hello world!" diff --git a/tests/newconfig/tfoo.nims b/tests/newconfig/tfoo.nims index 90205cddba..a2166576d0 100644 --- a/tests/newconfig/tfoo.nims +++ b/tests/newconfig/tfoo.nims @@ -10,5 +10,6 @@ task listDirs, "lists every subdirectory": echo "DIR ", x task default, "default target": + --define: definedefine setCommand "c"