summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorflywind <xzsflywind@gmail.com>2021-03-07 19:13:41 +0800
committerGitHub <noreply@github.com>2021-03-07 12:13:41 +0100
commitd1e093207acdd10ad375705bd1732fc6f0db9f55 (patch)
tree1cbbfbba3f8afd2355e38e28145754fbe2be7d46
parent0e3ea1655441036aa13d95ca1c47d9d27e0dff62 (diff)
downloadNim-d1e093207acdd10ad375705bd1732fc6f0db9f55.tar.gz
fix #17267 (#17273)
* remove unnecessary when statement

* remove outdated codes

* reuse jsffi

* move js json coverage

* fix #17267

* address comments

* Update compiler/main.nim

* Update tests/threads/tjsthreads.nim
-rw-r--r--compiler/commands.nim7
-rw-r--r--tests/threads/tjsthreads.nim6
2 files changed, 11 insertions, 2 deletions
diff --git a/compiler/commands.nim b/compiler/commands.nim
index 9c6af83d0..1a79ac2d1 100644
--- a/compiler/commands.nim
+++ b/compiler/commands.nim
@@ -613,7 +613,9 @@ proc processSwitch*(switch, arg: string, pass: TCmdLinePass, info: TLineInfo;
   of "hintaserror": processSpecificNote(arg, wHintAsError, pass, info, switch, conf)
   of "hints":
     if processOnOffSwitchOrList(conf, {optHints}, arg, pass, info): listHints(conf)
-  of "threadanalysis": processOnOffSwitchG(conf, {optThreadAnalysis}, arg, pass, info)
+  of "threadanalysis":
+    if conf.backend == backendJs: discard
+    else: processOnOffSwitchG(conf, {optThreadAnalysis}, arg, pass, info)
   of "stacktrace": processOnOffSwitch(conf, {optStackTrace}, arg, pass, info)
   of "stacktracemsgs": processOnOffSwitch(conf, {optStackTraceMsgs}, arg, pass, info)
   of "excessivestacktrace": processOnOffSwitchG(conf, {optExcessiveStackTrace}, arg, pass, info)
@@ -670,7 +672,8 @@ proc processSwitch*(switch, arg: string, pass: TCmdLinePass, info: TLineInfo;
   of "linedir": processOnOffSwitch(conf, {optLineDir}, arg, pass, info)
   of "assertions", "a": processOnOffSwitch(conf, {optAssert}, arg, pass, info)
   of "threads":
-    processOnOffSwitchG(conf, {optThreads}, arg, pass, info)
+    if conf.backend == backendJs: discard
+    else: processOnOffSwitchG(conf, {optThreads}, arg, pass, info)
     #if optThreads in conf.globalOptions: conf.setNote(warnGcUnsafe)
   of "tlsemulation": processOnOffSwitchG(conf, {optTlsEmulation}, arg, pass, info)
   of "implicitstatic":
diff --git a/tests/threads/tjsthreads.nim b/tests/threads/tjsthreads.nim
new file mode 100644
index 000000000..1085d9157
--- /dev/null
+++ b/tests/threads/tjsthreads.nim
@@ -0,0 +1,6 @@
+discard """
+  targets: "c cpp js"
+  matrix: "--threads"
+"""
+
+echo 123