summary refs log tree commit diff stats
path: root/compiler
diff options
context:
space:
mode:
authorflywind <43030857+xflywind@users.noreply.github.com>2020-10-30 16:58:55 +0800
committerGitHub <noreply@github.com>2020-10-30 09:58:55 +0100
commit17f08b2939db224d533db846fc3fa8ab91cc9755 (patch)
tree94654e4423c0e665f37e55dfdc6ec4c27746e498 /compiler
parent2de90a14cbc5182efad2cff63cd33f820e3a8832 (diff)
downloadNim-17f08b2939db224d533db846fc3fa8ab91cc9755.tar.gz
closes #7658 (#15784)
* fix #7658

* more
Diffstat (limited to 'compiler')
-rw-r--r--compiler/pragmas.nim9
1 files changed, 6 insertions, 3 deletions
diff --git a/compiler/pragmas.nim b/compiler/pragmas.nim
index c0c9cc06a..273b2b004 100644
--- a/compiler/pragmas.nim
+++ b/compiler/pragmas.nim
@@ -1110,9 +1110,12 @@ proc singlePragma(c: PContext, sym: PSym, n: PNode, i: var int,
         else:
           sym.typ.kind = tyUncheckedArray
       of wUnion:
-        noVal(c, it)
-        if sym.typ == nil: invalidPragma(c, it)
-        else: incl(sym.typ.flags, tfUnion)
+        if c.config.backend == backendJs:
+          localError(c.config, it.info, "`{.union.}` is not implemented for js backend.")
+        else:
+          noVal(c, it)
+          if sym.typ == nil: invalidPragma(c, it)
+          else: incl(sym.typ.flags, tfUnion)
       of wRequiresInit:
         noVal(c, it)
         if sym.kind == skField: