diff options
author | Andreas Rumpf <rumpf_a@web.de> | 2019-08-16 18:19:30 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-08-16 18:19:30 +0200 |
commit | 15e681ce66b0e2db0c6ed6555f39759f9c6b6932 (patch) | |
tree | 91c75d0117051a57fe6fd71c70a7c8d7110b2056 /compiler/main.nim | |
parent | 39f4a3e41872c35a6b4acd9d57dde7ffb5a09458 (diff) | |
download | Nim-15e681ce66b0e2db0c6ed6555f39759f9c6b6932.tar.gz |
fixes 'e' command handling; now only does what advopt.txt claims it does (#11961)
* fixes 'e' command handling; now only does what advopt.txt claims it does * address Timothee's remark
Diffstat (limited to 'compiler/main.nim')
-rw-r--r-- | compiler/main.nim | 15 |
1 files changed, 5 insertions, 10 deletions
diff --git a/compiler/main.nim b/compiler/main.nim index f8ca2ba59..8cd8a52d4 100644 --- a/compiler/main.nim +++ b/compiler/main.nim @@ -150,14 +150,6 @@ const evalPasses = [verbosePass, semPass, evalPass] proc evalNim(graph: ModuleGraph; nodes: PNode, module: PSym) = carryPasses(graph, nodes, module, evalPasses) -proc commandEval(graph: ModuleGraph; exp: string) = - if graph.systemModule == nil: - interactivePasses(graph) - compileSystemModule(graph) - let echoExp = "echo \"eval\\t\", " & "repr(" & exp & ")" - evalNim(graph, echoExp.parseString(graph.cache, graph.config), - makeStdinModule(graph)) - proc commandScan(cache: IdentCache, config: ConfigRef) = var f = addFileExt(AbsoluteFile mainCommandArg(config), NimExt) var stream = llStreamOpen(f, fmRead) @@ -345,8 +337,11 @@ proc mainCommand*(graph: ModuleGraph) = conf.cmd = cmdInteractive commandInteractive(graph) of "e": - incl conf.globalOptions, optWasNimscript - commandEval(graph, mainCommandArg(conf)) + if not fileExists(conf.projectFull): + rawMessage(conf, errGenerated, "NimScript file does not exist: " & conf.projectFull.string) + elif not conf.projectFull.string.endsWith(".nims"): + rawMessage(conf, errGenerated, "not a NimScript file: " & conf.projectFull.string) + # main NimScript logic handled in cmdlinehelper.nim. of "nop", "help": # prevent the "success" message: conf.cmd = cmdDump |