Added support for unions as a step towards lowering ADTs in the next pass to be written.

This commit is contained in:
Nathan Braswell
2016-06-15 22:26:03 -07:00
parent d44293a48b
commit 4de7dd1210
8 changed files with 55 additions and 13 deletions

View File

@@ -0,0 +1,3 @@
true
4
4.400000

22
tests/test_union.krak Normal file
View File

@@ -0,0 +1,22 @@
import io:*
uni packed {
var a: int
var b: double
}
obj loose {
var a: int
var b: double
}
fun main():int {
var a: packed
var b: loose
println(#sizeof<packed> < #sizeof<loose>)
a.a = 4
println(a.a)
a.b = 4.4
println(a.b)
return 0
}