Add enum type info and fix enum casting

This commit is contained in:
Ginger Bill
2017-01-01 16:58:38 +00:00
parent 6fef74317c
commit 311b5cb6e2
11 changed files with 178 additions and 193 deletions

View File

@@ -11,13 +11,14 @@ import {
win32 "sys/windows.odin";
}
type Thing enum f64 {
_, // Ignore first value
A = 1<<(10*iota),
B,
C,
D,
}
};
proc main() {
var ti = type_info(Thing);
@@ -32,6 +33,8 @@ proc main() {
fmt.println();
}
fmt.println(Thing.A, Thing.B, Thing.C, Thing.D);
var x Thing = Thing.A;
fmt.println(x, Thing.B, Thing.C, Thing.D);
}