diff options
author | cooldome <ariabushenko@bk.ru> | 2018-06-26 23:33:34 +0100 |
---|---|---|
committer | cooldome <ariabushenko@bk.ru> | 2018-06-26 23:33:34 +0100 |
commit | 34170db96308c367357ece15404815727bce223a (patch) | |
tree | 0461d115e39feff0b5ea855fb56f9882ce1eba2c /compiler/nim.nim | |
parent | 0b709fb916923b0d5e9eab06fc8766e46e63d955 (diff) | |
parent | 19ea3a70d2d6d404235e0f5250d6b681d56903a5 (diff) | |
download | Nim-34170db96308c367357ece15404815727bce223a.tar.gz |
Merge branch 'devel' into Fixes-7845
Diffstat (limited to 'compiler/nim.nim')
-rw-r--r-- | compiler/nim.nim | 27 |
1 files changed, 23 insertions, 4 deletions
diff --git a/compiler/nim.nim b/compiler/nim.nim index d3e00017f..90049bdfb 100644 --- a/compiler/nim.nim +++ b/compiler/nim.nim @@ -20,8 +20,8 @@ when defined(i386) and defined(windows) and defined(vcc): import commands, lexer, condsyms, options, msgs, nversion, nimconf, ropes, - extccomp, strutils, os, osproc, platform, main, parseopt, service, - nodejs, scriptconfig, idents, modulegraphs, configuration + extccomp, strutils, os, osproc, platform, main, parseopt, + nodejs, scriptconfig, idents, modulegraphs, lineinfos when hasTinyCBackend: import tccgen @@ -37,6 +37,25 @@ proc prependCurDir(f: string): string = else: result = f +proc processCmdLine(pass: TCmdLinePass, cmd: string; config: ConfigRef) = + var p = parseopt.initOptParser(cmd) + var argsCount = 0 + while true: + parseopt.next(p) + case p.kind + of cmdEnd: break + of cmdLongoption, cmdShortOption: + if p.key == " ": + p.key = "-" + if processArgument(pass, p, argsCount, config): break + else: + processSwitch(pass, p, config) + of cmdArgument: + if processArgument(pass, p, argsCount, config): break + if pass == passCmd2: + if optRun notin config.globalOptions and config.arguments.len > 0 and config.command.normalize != "run": + rawMessage(config, errGenerated, errArgsNeedRunOption) + proc handleCmdLine(cache: IdentCache; conf: ConfigRef) = condsyms.initDefines(conf.symbols) if paramCount() == 0: @@ -60,7 +79,7 @@ proc handleCmdLine(cache: IdentCache; conf: ConfigRef) = conf.projectName = p.name else: conf.projectPath = canonicalizePath(conf, getCurrentDir()) - loadConfigs(DefaultConfig, conf) # load all config files + loadConfigs(DefaultConfig, cache, conf) # load all config files let scriptFile = conf.projectFull.changeFileExt("nims") if fileExists(scriptFile): runNimScript(cache, scriptFile, freshDefines=false, conf) @@ -75,7 +94,7 @@ proc handleCmdLine(cache: IdentCache; conf: ConfigRef) = processCmdLine(passCmd2, "", conf) if conf.command == "": rawMessage(conf, errGenerated, "command missing") - mainCommand(newModuleGraph(conf), cache) + mainCommand(newModuleGraph(cache, conf)) if optHints in conf.options and hintGCStats in conf.notes: echo(GC_getStatistics()) #echo(GC_getStatistics()) if conf.errorCounter == 0: |