Properly resolve enum value siblings

This commit is contained in:
dcodeIO
2018-01-24 03:08:09 +01:00
parent 29935948f2
commit b548b5c81f
7 changed files with 50 additions and 7 deletions

View File

@ -14,6 +14,8 @@
(global $enum/Mixed.FOUR i32 (i32.const 4))
(global $enum/NonConstant.ZERO (mut i32) (i32.const 0))
(global $enum/NonConstant.ONE (mut i32) (i32.const 0))
(global $enum/SelfReference.ZERO i32 (i32.const 0))
(global $enum/SelfReference.ONE i32 (i32.const 1))
(memory $0 1)
(export "enum/Implicit.ZERO" (global $enum/Implicit.ZERO))
(export "enum/Implicit.ONE" (global $enum/Implicit.ONE))
@ -27,6 +29,8 @@
(export "enum/Mixed.ONE" (global $enum/Mixed.ONE))
(export "enum/Mixed.THREE" (global $enum/Mixed.THREE))
(export "enum/Mixed.FOUR" (global $enum/Mixed.FOUR))
(export "enum/SelfReference.ZERO" (global $enum/SelfReference.ZERO))
(export "enum/SelfReference.ONE" (global $enum/SelfReference.ONE))
(export "memory" (memory $0))
(start $start)
(func $start (; 0 ;) (type $v)

View File

@ -27,3 +27,8 @@ export enum NonConstant {
ZERO = getZero(), // cannot export a mutable global
ONE // cannot export a mutable global (tsc doesn't allow this)
}
export enum SelfReference {
ZERO,
ONE = ZERO + 1
}

View File

@ -15,6 +15,8 @@
(global $enum/Mixed.FOUR i32 (i32.const 4))
(global $enum/NonConstant.ZERO (mut i32) (i32.const 0))
(global $enum/NonConstant.ONE (mut i32) (i32.const 0))
(global $enum/SelfReference.ZERO i32 (i32.const 0))
(global $enum/SelfReference.ONE i32 (i32.const 1))
(global $HEAP_BASE i32 (i32.const 4))
(memory $0 1)
(export "enum/Implicit.ZERO" (global $enum/Implicit.ZERO))
@ -29,6 +31,8 @@
(export "enum/Mixed.ONE" (global $enum/Mixed.ONE))
(export "enum/Mixed.THREE" (global $enum/Mixed.THREE))
(export "enum/Mixed.FOUR" (global $enum/Mixed.FOUR))
(export "enum/SelfReference.ZERO" (global $enum/SelfReference.ZERO))
(export "enum/SelfReference.ONE" (global $enum/SelfReference.ONE))
(export "memory" (memory $0))
(start $start)
(func $enum/getZero (; 0 ;) (type $i) (result i32)
@ -97,9 +101,11 @@
ENUM: enum/Mixed
FUNCTION_PROTOTYPE: enum/getZero
ENUM: enum/NonConstant
ENUM: enum/SelfReference
[program.exports]
ENUM: enum/Implicit
ENUM: enum/Explicit
ENUM: enum/Mixed
ENUM: enum/NonConstant
ENUM: enum/SelfReference
;)