-
-
Notifications
You must be signed in to change notification settings - Fork 677
Closed
Labels
Description
Bug description
&&
can't be calculated at compile time, but ?:
can.
Steps to reproduce
input assemblyscript:
class A{
foo!:i32
bar!:i32
}
export const compiletime=offsetof<A>('foo')==0?offsetof<A>('bar')==4:0
export const runtime=offsetof<A>('foo')==0&&offsetof<A>('bar')==4
output wat:
(module
(type $0 (func))
(global $example/compiletime i32 (i32.const 1))
(global $example/runtime (mut i32) (i32.const 0))
(memory $0 0)
(table $0 1 1 funcref)
(elem $0 (i32.const 1))
(export "compiletime" (global $example/compiletime))
(export "runtime" (global $example/runtime))
(export "memory" (memory $0))
(start $~start)
(func $start:example
(local $0 i32)
i32.const 0
i32.const 0
i32.eq
local.tee $0
if (result i32)
i32.const 4
i32.const 4
i32.eq
else
local.get $0
end
i32.const 0
i32.ne
global.set $example/runtime
)
(func $~start
call $start:example
)
)
AssemblyScript version
0.27.37