fixes #11675
This commit is contained in:
parent
8362d92e47
commit
3255b55266
2 changed files with 15 additions and 1 deletions
|
|
@ -110,7 +110,7 @@ type
|
||||||
cmdJsonScript # compile a .json build file
|
cmdJsonScript # compile a .json build file
|
||||||
TStringSeq* = seq[string]
|
TStringSeq* = seq[string]
|
||||||
TGCMode* = enum # the selected GC
|
TGCMode* = enum # the selected GC
|
||||||
gcNone, gcBoehm, gcRegions, gcMarkAndSweep, gcDestructors,
|
gcUnselected, gcNone, gcBoehm, gcRegions, gcMarkAndSweep, gcDestructors,
|
||||||
gcRefc, gcV2, gcGo
|
gcRefc, gcV2, gcGo
|
||||||
# gcRefc and the GCs that follow it use a write barrier,
|
# gcRefc and the GCs that follow it use a write barrier,
|
||||||
# as far as usesWriteBarrier() is concerned
|
# as far as usesWriteBarrier() is concerned
|
||||||
|
|
|
||||||
|
|
@ -214,6 +214,12 @@ proc runNimScript*(cache: IdentCache; scriptName: AbsoluteFile;
|
||||||
|
|
||||||
conf.searchPaths.add(conf.libpath)
|
conf.searchPaths.add(conf.libpath)
|
||||||
|
|
||||||
|
let oldGlobalOptions = conf.globalOptions
|
||||||
|
let oldSelectedGC = conf.selectedGC
|
||||||
|
undefSymbol(conf.symbols, "nimv2")
|
||||||
|
conf.globalOptions.excl optNimV2
|
||||||
|
conf.selectedGC = gcUnselected
|
||||||
|
|
||||||
var m = graph.makeModule(scriptName)
|
var m = graph.makeModule(scriptName)
|
||||||
incl(m.flags, sfMainModule)
|
incl(m.flags, sfMainModule)
|
||||||
graph.vm = setupVM(m, cache, scriptName.string, graph)
|
graph.vm = setupVM(m, cache, scriptName.string, graph)
|
||||||
|
|
@ -221,6 +227,14 @@ proc runNimScript*(cache: IdentCache; scriptName: AbsoluteFile;
|
||||||
graph.compileSystemModule() # TODO: see why this unsets hintConf in conf.notes
|
graph.compileSystemModule() # TODO: see why this unsets hintConf in conf.notes
|
||||||
discard graph.processModule(m, llStreamOpen(scriptName, fmRead))
|
discard graph.processModule(m, llStreamOpen(scriptName, fmRead))
|
||||||
|
|
||||||
|
# watch out, "newruntime" can be set within NimScript itself and then we need
|
||||||
|
# to remember this:
|
||||||
|
if optNimV2 in oldGlobalOptions:
|
||||||
|
conf.globalOptions.incl optNimV2
|
||||||
|
defineSymbol(conf.symbols, "nimv2")
|
||||||
|
if conf.selectedGC == gcUnselected:
|
||||||
|
conf.selectedGC = oldSelectedGC
|
||||||
|
|
||||||
# ensure we load 'system.nim' again for the real non-config stuff!
|
# ensure we load 'system.nim' again for the real non-config stuff!
|
||||||
resetSystemArtifacts(graph)
|
resetSystemArtifacts(graph)
|
||||||
# do not remove the defined symbols
|
# do not remove the defined symbols
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue