diff options
author | flywind <xzsflywind@gmail.com> | 2022-03-24 04:09:44 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-03-23 21:09:44 +0100 |
commit | 7c3c61f2f1e898e5c70dfd619d94d09e339836e4 (patch) | |
tree | 65944e5fc323c6099236dfa05a248d45d5470b42 /compiler | |
parent | a262a87bbebdaf41ea248f7caa780f8ea27e20e1 (diff) | |
download | Nim-7c3c61f2f1e898e5c70dfd619d94d09e339836e4.tar.gz |
fix nim check nimscript [backport: 1.6] (#19444)
fix #19440; fix #3858
Diffstat (limited to 'compiler')
-rw-r--r-- | compiler/commands.nim | 2 | ||||
-rw-r--r-- | compiler/main.nim | 6 |
2 files changed, 7 insertions, 1 deletions
diff --git a/compiler/commands.nim b/compiler/commands.nim index 4c1cec3d2..98537e9ef 100644 --- a/compiler/commands.nim +++ b/compiler/commands.nim @@ -1112,6 +1112,8 @@ proc processArgument*(pass: TCmdLinePass; p: OptParser; else: if pass == passCmd1: config.commandArgs.add p.key if argsCount == 1: + if p.key.endsWith(".nims"): + incl(config.globalOptions, optWasNimscript) # support UNIX style filenames everywhere for portable build scripts: if config.projectName.len == 0: config.projectName = unixToNativePath(p.key) diff --git a/compiler/main.nim b/compiler/main.nim index 3cddbffb3..e27a4f6d1 100644 --- a/compiler/main.nim +++ b/compiler/main.nim @@ -62,6 +62,9 @@ proc commandCheck(graph: ModuleGraph) = let conf = graph.config conf.setErrorMaxHighMaybe defineSymbol(conf.symbols, "nimcheck") + if optWasNimscript in conf.globalOptions: + defineSymbol(conf.symbols, "nimscript") + defineSymbol(conf.symbols, "nimconfig") semanticPasses(graph) # use an empty backend for semantic checking only compileProject(graph) @@ -367,7 +370,8 @@ proc mainCommand*(graph: ModuleGraph) = msgWriteln(conf, "-- end of list --", {msgStdout, msgSkipHook}) for it in conf.searchPaths: msgWriteln(conf, it.string) - of cmdCheck: commandCheck(graph) + of cmdCheck: + commandCheck(graph) of cmdParse: wantMainModule(conf) discard parseFile(conf.projectMainIdx, cache, conf) |