Nimsuggest now defines the backends symbol (#21083)

* Add testcase

* Define the backend symbol

* Remove unneeded whitespace
This commit is contained in:
Jake Leahy 2022-12-13 08:19:02 +11:00 • committed by GitHub
commit b0a850adbf
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 13 additions and 2 deletions

View file

@ -27,7 +27,7 @@ import compiler / [options, commands, modules, sem,
passes, passaux, msgs, passes, passaux, msgs,
sigmatch, ast, sigmatch, ast,
idents, modulegraphs, prefixmatches, lineinfos, cmdlinehelper, idents, modulegraphs, prefixmatches, lineinfos, cmdlinehelper,
pathutils] pathutils, condsyms]
when defined(nimPreviewSlimSystem): when defined(nimPreviewSlimSystem):
import std/typedthreads import std/typedthreads
@ -553,6 +553,7 @@ proc mainCommand(graph: ModuleGraph) =
registerPass graph, verbosePass registerPass graph, verbosePass
registerPass graph, semPass registerPass graph, semPass
conf.setCmd cmdIdeTools conf.setCmd cmdIdeTools
defineSymbol(conf.symbols, $conf.backend)
wantMainModule(conf) wantMainModule(conf)
if not fileExists(conf.projectFull): if not fileExists(conf.projectFull):
@ -952,10 +953,12 @@ else:
proc mockCommand(graph: ModuleGraph) = proc mockCommand(graph: ModuleGraph) =
retval = graph retval = graph
let conf = graph.config let conf = graph.config
conf.setCmd cmdIdeTools
defineSymbol(conf.symbols, $conf.backend)
clearPasses(graph) clearPasses(graph)
registerPass graph, verbosePass registerPass graph, verbosePass
registerPass graph, semPass registerPass graph, semPass
conf.setCmd cmdIdeTools
wantMainModule(conf) wantMainModule(conf)
if not fileExists(conf.projectFull): if not fileExists(conf.projectFull):

View file

@ -0,0 +1,7 @@
when not defined(js):
{.fatal: "Crash".}
echo 4
discard """
$nimsuggest --v3 --tester $file
"""

View file

@ -0,0 +1 @@
switch("backend", "js")