replaces implicit passes array registed at runtime with explicit function calls; simplify compilation pipeline (#21444)

* abolish using passes in the compiler; simplify compilation pipeline

* duplicate code

* Really cool to have the same signature...

* haul

* unify other backends

* refactor process

* introduce PipelinePhase

* refactor compiler

* fixes passes

* fixes nimsuggest

* add a sentinel

* enable docs checkj

* activate doc testing

* clean up

* complete cleanups
This commit is contained in:
ringabout 2023-03-03 14:36:38 +08:00 • committed by GitHub
commit d51a392149
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
17 changed files with 531 additions and 313 deletions

View file

@ -11,10 +11,10 @@
## language.
import
ast, modules, idents, passes, condsyms,
options, sem, llstream, vm, vmdef, commands,
ast, modules, idents, condsyms,
options, llstream, vm, vmdef, commands,
os, times, osproc, wordrecg, strtabs, modulegraphs,
pathutils
pathutils, pipelines
when defined(nimPreviewSlimSystem):
import std/syncio
@ -197,13 +197,11 @@ proc runNimScript*(cache: IdentCache; scriptName: AbsoluteFile;
conf.symbolFiles = disabledSf
let graph = newModuleGraph(cache, conf)
connectCallbacks(graph)
connectPipelineCallbacks(graph)
if freshDefines: initDefines(conf.symbols)
defineSymbol(conf.symbols, "nimscript")
defineSymbol(conf.symbols, "nimconfig")
registerPass(graph, semPass)
registerPass(graph, evalPass)
conf.searchPaths.add(conf.libpath)
@ -218,8 +216,9 @@ proc runNimScript*(cache: IdentCache; scriptName: AbsoluteFile;
var vm = setupVM(m, cache, scriptName.string, graph, idgen)
graph.vm = vm
graph.compileSystemModule()
discard graph.processModule(m, vm.idgen, stream)
graph.setPipeLinePass(EvalPass)
graph.compilePipelineSystemModule()
discard graph.processPipelineModule(m, vm.idgen, stream)
# watch out, "newruntime" can be set within NimScript itself and then we need
# to remember this: