parent
2de90a14cb
commit
17f08b2939
2 changed files with 13 additions and 3 deletions
|
|
@ -1110,6 +1110,9 @@ proc singlePragma(c: PContext, sym: PSym, n: PNode, i: var int,
|
||||||
else:
|
else:
|
||||||
sym.typ.kind = tyUncheckedArray
|
sym.typ.kind = tyUncheckedArray
|
||||||
of wUnion:
|
of wUnion:
|
||||||
|
if c.config.backend == backendJs:
|
||||||
|
localError(c.config, it.info, "`{.union.}` is not implemented for js backend.")
|
||||||
|
else:
|
||||||
noVal(c, it)
|
noVal(c, it)
|
||||||
if sym.typ == nil: invalidPragma(c, it)
|
if sym.typ == nil: invalidPragma(c, it)
|
||||||
else: incl(sym.typ.flags, tfUnion)
|
else: incl(sym.typ.flags, tfUnion)
|
||||||
|
|
|
||||||
7
tests/js/tunion.nim
Normal file
7
tests/js/tunion.nim
Normal file
|
|
@ -0,0 +1,7 @@
|
||||||
|
discard """
|
||||||
|
errormsg: "`{.union.}` is not implemented for js backend."
|
||||||
|
"""
|
||||||
|
|
||||||
|
type Foo {.union.} = object
|
||||||
|
as_bytes: array[8, int8]
|
||||||
|
data: int64
|
||||||
Loading…
Add table
Add a link
Reference in a new issue