mirror of
https://github.com/nim-lang/Nim.git
synced 2026-02-12 06:18:51 +00:00
Nimsuggest now defines the backends symbol (#21083)
* Add testcase * Define the backend symbol * Remove unneeded whitespace
This commit is contained in:
@@ -27,7 +27,7 @@ import compiler / [options, commands, modules, sem,
|
||||
passes, passaux, msgs,
|
||||
sigmatch, ast,
|
||||
idents, modulegraphs, prefixmatches, lineinfos, cmdlinehelper,
|
||||
pathutils]
|
||||
pathutils, condsyms]
|
||||
|
||||
when defined(nimPreviewSlimSystem):
|
||||
import std/typedthreads
|
||||
@@ -553,6 +553,7 @@ proc mainCommand(graph: ModuleGraph) =
|
||||
registerPass graph, verbosePass
|
||||
registerPass graph, semPass
|
||||
conf.setCmd cmdIdeTools
|
||||
defineSymbol(conf.symbols, $conf.backend)
|
||||
wantMainModule(conf)
|
||||
|
||||
if not fileExists(conf.projectFull):
|
||||
@@ -952,10 +953,12 @@ else:
|
||||
proc mockCommand(graph: ModuleGraph) =
|
||||
retval = graph
|
||||
let conf = graph.config
|
||||
conf.setCmd cmdIdeTools
|
||||
defineSymbol(conf.symbols, $conf.backend)
|
||||
clearPasses(graph)
|
||||
registerPass graph, verbosePass
|
||||
registerPass graph, semPass
|
||||
conf.setCmd cmdIdeTools
|
||||
|
||||
wantMainModule(conf)
|
||||
|
||||
if not fileExists(conf.projectFull):
|
||||
|
||||
7
nimsuggest/tests/t20440.nim
Normal file
7
nimsuggest/tests/t20440.nim
Normal file
@@ -0,0 +1,7 @@
|
||||
when not defined(js):
|
||||
{.fatal: "Crash".}
|
||||
echo 4
|
||||
|
||||
discard """
|
||||
$nimsuggest --v3 --tester $file
|
||||
"""
|
||||
1
nimsuggest/tests/t20440.nims
Normal file
1
nimsuggest/tests/t20440.nims
Normal file
@@ -0,0 +1 @@
|
||||
switch("backend", "js")
|
||||
Reference in New Issue
Block a user