diff options
-rw-r--r-- | compiler/commands.nim | 9 | ||||
-rw-r--r-- | compiler/nim.nim | 6 | ||||
-rw-r--r-- | compiler/options.nim | 2 | ||||
-rw-r--r-- | compiler/service.nim | 2 |
4 files changed, 8 insertions, 11 deletions
diff --git a/compiler/commands.nim b/compiler/commands.nim index dc5d808ec..591bf8883 100644 --- a/compiler/commands.nim +++ b/compiler/commands.nim @@ -733,11 +733,6 @@ proc processCommand(switch: string, pass: TCmdLinePass; config: ConfigRef) = processSwitch(cmd, arg, pass, gCmdLineInfo, config) -var - arguments* = "" - # the arguments to be passed to the program that - # should be run - proc processSwitch*(pass: TCmdLinePass; p: OptParser; config: ConfigRef) = # hint[X]:off is parsed as (p.key = "hint[X]", p.val = "off") # we fix this here @@ -756,7 +751,7 @@ proc processArgument*(pass: TCmdLinePass; p: OptParser; if p.key.endswith(".nims"): options.command = "e" options.gProjectName = unixToNativePath(p.key) - arguments = cmdLineRest(p) + config.arguments = cmdLineRest(p) result = true elif pass != passCmd2: options.command = p.key @@ -765,6 +760,6 @@ proc processArgument*(pass: TCmdLinePass; p: OptParser; if argsCount == 1: # support UNIX style filenames everywhere for portable build scripts: options.gProjectName = unixToNativePath(p.key) - arguments = cmdLineRest(p) + config.arguments = cmdLineRest(p) result = true inc argsCount diff --git a/compiler/nim.nim b/compiler/nim.nim index 3fa733303..280782330 100644 --- a/compiler/nim.nim +++ b/compiler/nim.nim @@ -80,7 +80,7 @@ proc handleCmdLine(cache: IdentCache; config: ConfigRef) = if msgs.gErrorCounter == 0: when hasTinyCBackend: if gCmd == cmdRun: - tccgen.run(commands.arguments) + tccgen.run(config.arguments) if optRun in gGlobalOptions: if gCmd == cmdCompileToJS: var ex: string @@ -89,7 +89,7 @@ proc handleCmdLine(cache: IdentCache; config: ConfigRef) = else: ex = quoteShell( completeCFilePath(changeFileExt(gProjectFull, "js").prependCurDir)) - execExternalProgram(findNodeJs() & " " & ex & ' ' & commands.arguments) + execExternalProgram(findNodeJs() & " " & ex & ' ' & config.arguments) else: var binPath: string if options.outFile.len > 0: @@ -99,7 +99,7 @@ proc handleCmdLine(cache: IdentCache; config: ConfigRef) = # Figure out ourselves a valid binary name. binPath = changeFileExt(gProjectFull, ExeExt).prependCurDir var ex = quoteShell(binPath) - execExternalProgram(ex & ' ' & commands.arguments) + execExternalProgram(ex & ' ' & config.arguments) when declared(GC_setMaxPause): GC_setMaxPause 2_000 diff --git a/compiler/options.nim b/compiler/options.nim index 24c9d0f73..a5dfaa81c 100644 --- a/compiler/options.nim +++ b/compiler/options.nim @@ -114,6 +114,8 @@ type cppDefines*: HashSet[string] headerFile*: string features*: set[Feature] + arguments*: string ## the arguments to be passed to the program that + ## should be run const oldExperimentalFeatures* = {implicitDeref, dotOperators, callOperator, parallel} diff --git a/compiler/service.nim b/compiler/service.nim index 7cdfc112c..6ec9b9046 100644 --- a/compiler/service.nim +++ b/compiler/service.nim @@ -42,7 +42,7 @@ proc processCmdLine*(pass: TCmdLinePass, cmd: string; config: ConfigRef) = of cmdArgument: if processArgument(pass, p, argsCount, config): break if pass == passCmd2: - if optRun notin gGlobalOptions and arguments != "" and options.command.normalize != "run": + if optRun notin gGlobalOptions and config.arguments.len > 0 and options.command.normalize != "run": rawMessage(errArgsNeedRunOption, []) proc serve*(cache: IdentCache; action: proc (cache: IdentCache){.nimcall.}; config: ConfigRef) = |