mirror of
https://github.com/nim-lang/Nim.git
synced 2026-04-26 09:14:00 +00:00
compiler refactoring; use typesafe path handing; docgen: render symbols between modules
This commit is contained in:
@@ -13,7 +13,7 @@
|
||||
import
|
||||
ast, modules, idents, passes, passaux, condsyms,
|
||||
options, nimconf, sem, semdata, llstream, vm, vmdef, commands, msgs,
|
||||
os, times, osproc, wordrecg, strtabs, modulegraphs, lineinfos
|
||||
os, times, osproc, wordrecg, strtabs, modulegraphs, lineinfos, pathutils
|
||||
|
||||
# we support 'cmpIgnoreStyle' natively for efficiency:
|
||||
from strutils import cmpIgnoreStyle, contains
|
||||
@@ -105,7 +105,7 @@ proc setupVM*(module: PSym; cache: IdentCache; scriptName: string;
|
||||
cbconf exists:
|
||||
setResult(a, options.existsConfigVar(conf, a.getString 0))
|
||||
cbconf nimcacheDir:
|
||||
setResult(a, options.getNimcacheDir(conf))
|
||||
setResult(a, options.getNimcacheDir(conf).string)
|
||||
cbconf paramStr:
|
||||
setResult(a, os.paramStr(int a.getInt 0))
|
||||
cbconf paramCount:
|
||||
@@ -120,8 +120,8 @@ proc setupVM*(module: PSym; cache: IdentCache; scriptName: string;
|
||||
if arg.len > 0:
|
||||
conf.projectName = arg
|
||||
let path =
|
||||
if conf.projectName.isAbsolute: conf.projectName
|
||||
else: conf.projectPath / conf.projectName
|
||||
if conf.projectName.isAbsolute: AbsoluteFile(conf.projectName)
|
||||
else: conf.projectPath / RelativeFile(conf.projectName)
|
||||
try:
|
||||
conf.projectFull = canonicalizePath(conf, path)
|
||||
except OSError:
|
||||
@@ -149,9 +149,9 @@ proc setupVM*(module: PSym; cache: IdentCache; scriptName: string;
|
||||
cbconf cppDefine:
|
||||
options.cppDefine(conf, a.getString(0))
|
||||
|
||||
proc runNimScript*(cache: IdentCache; scriptName: string;
|
||||
proc runNimScript*(cache: IdentCache; scriptName: AbsoluteFile;
|
||||
freshDefines=true; conf: ConfigRef) =
|
||||
rawMessage(conf, hintConf, scriptName)
|
||||
rawMessage(conf, hintConf, scriptName.string)
|
||||
|
||||
let graph = newModuleGraph(cache, conf)
|
||||
connectCallbacks(graph)
|
||||
@@ -169,7 +169,7 @@ proc runNimScript*(cache: IdentCache; scriptName: string;
|
||||
|
||||
var m = graph.makeModule(scriptName)
|
||||
incl(m.flags, sfMainModule)
|
||||
graph.vm = setupVM(m, cache, scriptName, graph)
|
||||
graph.vm = setupVM(m, cache, scriptName.string, graph)
|
||||
|
||||
graph.compileSystemModule() # TODO: see why this unsets hintConf in conf.notes
|
||||
discard graph.processModule(m, llStreamOpen(scriptName, fmRead))
|
||||
|
||||
Reference in New Issue
Block a user