diff options
author | Ganesh Viswanathan <dev@genotrance.com> | 2018-09-14 18:34:56 -0500 |
---|---|---|
committer | Ganesh Viswanathan <dev@genotrance.com> | 2018-09-14 18:34:56 -0500 |
commit | 80520eef3cce0b3145dedc71a6652429adb9cc9e (patch) | |
tree | d64725d2749cb82bfef997bbbdb443cc4827de6d /compiler/modules.nim | |
parent | e07a256f74b9e89e49287c8a21c1334af43e27c2 (diff) | |
parent | b9dc486db15bb1b4b6f3cef7626733b904d377f7 (diff) | |
download | Nim-80520eef3cce0b3145dedc71a6652429adb9cc9e.tar.gz |
Merge remote-tracking branch 'upstream/devel' into test-6483
Diffstat (limited to 'compiler/modules.nim')
-rw-r--r-- | compiler/modules.nim | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/compiler/modules.nim b/compiler/modules.nim index b3a1e90d6..8fedba10a 100644 --- a/compiler/modules.nim +++ b/compiler/modules.nim @@ -12,7 +12,7 @@ import ast, astalgo, magicsys, std / sha1, msgs, cgendata, sigmatch, options, idents, os, lexer, idgen, passes, syntaxes, llstream, modulegraphs, rod, - lineinfos + lineinfos, pathutils proc resetSystemArtifacts*(g: ModuleGraph) = magicsys.resetSysTypes(g) @@ -102,19 +102,21 @@ proc connectCallbacks*(graph: ModuleGraph) = proc compileSystemModule*(graph: ModuleGraph) = if graph.systemModule == nil: connectCallbacks(graph) - graph.config.m.systemFileIdx = fileInfoIdx(graph.config, graph.config.libpath / "system.nim") + graph.config.m.systemFileIdx = fileInfoIdx(graph.config, + graph.config.libpath / RelativeFile"system.nim") discard graph.compileModule(graph.config.m.systemFileIdx, {sfSystemModule}) proc wantMainModule*(conf: ConfigRef) = - if conf.projectFull.len == 0: - fatal(conf, newLineInfo(conf, "command line", 1, 1), errGenerated, "command expects a filename") + if conf.projectFull.isEmpty: + fatal(conf, newLineInfo(conf, AbsoluteFile"command line", 1, 1), errGenerated, + "command expects a filename") conf.projectMainIdx = fileInfoIdx(conf, addFileExt(conf.projectFull, NimExt)) proc compileProject*(graph: ModuleGraph; projectFileIdx = InvalidFileIDX) = connectCallbacks(graph) let conf = graph.config wantMainModule(conf) - let systemFileIdx = fileInfoIdx(conf, conf.libpath / "system.nim") + let systemFileIdx = fileInfoIdx(conf, conf.libpath / RelativeFile"system.nim") let projectFile = if projectFileIdx == InvalidFileIDX: conf.projectMainIdx else: projectFileIdx graph.importStack.add projectFile if projectFile == systemFileIdx: @@ -123,8 +125,11 @@ proc compileProject*(graph: ModuleGraph; projectFileIdx = InvalidFileIDX) = graph.compileSystemModule() discard graph.compileModule(projectFile, {sfMainModule}) -proc makeModule*(graph: ModuleGraph; filename: string): PSym = +proc makeModule*(graph: ModuleGraph; filename: AbsoluteFile): PSym = result = graph.newModule(fileInfoIdx(graph.config, filename)) result.id = getID() -proc makeStdinModule*(graph: ModuleGraph): PSym = graph.makeModule"stdin" +proc makeModule*(graph: ModuleGraph; filename: string): PSym = + result = makeModule(graph, AbsoluteFile filename) + +proc makeStdinModule*(graph: ModuleGraph): PSym = graph.makeModule(AbsoluteFile"stdin") |