mirror of
https://github.com/fluencelabs/assemblyscript
synced 2025-06-24 12:11:50 +00:00
null checking throughout logical and/or
This commit is contained in:
@ -1,6 +1,7 @@
|
||||
(module
|
||||
(type $FUNCSIG$vi (func (param i32)))
|
||||
(type $FUNCSIG$vii (func (param i32 i32)))
|
||||
(type $FUNCSIG$ii (func (param i32) (result i32)))
|
||||
(type $FUNCSIG$v (func))
|
||||
(memory $0 0)
|
||||
(table $0 1 funcref)
|
||||
@ -18,6 +19,10 @@
|
||||
(export "testWhile" (func $possibly-null/testWhile))
|
||||
(export "testWhile2" (func $possibly-null/testWhile2))
|
||||
(export "testWhile3" (func $possibly-null/testWhile3))
|
||||
(export "testLogicalAnd" (func $possibly-null/testLogicalAnd))
|
||||
(export "testLogicalOr" (func $possibly-null/testLogicalOr))
|
||||
(export "testLogicalAndMulti" (func $possibly-null/testLogicalAndMulti))
|
||||
(export "testLogicalOrMulti" (func $possibly-null/testLogicalOrMulti))
|
||||
(func $possibly-null/testTrue (; 0 ;) (type $FUNCSIG$vi) (param $0 i32)
|
||||
local.get $0
|
||||
if
|
||||
@ -128,6 +133,58 @@
|
||||
end
|
||||
end
|
||||
)
|
||||
(func $null (; 12 ;) (type $FUNCSIG$v)
|
||||
(func $possibly-null/requireNonNull (; 12 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32)
|
||||
local.get $0
|
||||
)
|
||||
(func $possibly-null/testLogicalAnd (; 13 ;) (type $FUNCSIG$vi) (param $0 i32)
|
||||
local.get $0
|
||||
if (result i32)
|
||||
local.get $0
|
||||
call $possibly-null/requireNonNull
|
||||
else
|
||||
i32.const 0
|
||||
end
|
||||
drop
|
||||
)
|
||||
(func $possibly-null/testLogicalOr (; 14 ;) (type $FUNCSIG$vi) (param $0 i32)
|
||||
local.get $0
|
||||
i32.eqz
|
||||
if (result i32)
|
||||
i32.const 1
|
||||
else
|
||||
local.get $0
|
||||
call $possibly-null/requireNonNull
|
||||
i32.const 0
|
||||
i32.ne
|
||||
end
|
||||
drop
|
||||
)
|
||||
(func $possibly-null/testLogicalAndMulti (; 15 ;) (type $FUNCSIG$vii) (param $0 i32) (param $1 i32)
|
||||
local.get $0
|
||||
if (result i32)
|
||||
local.get $1
|
||||
else
|
||||
i32.const 0
|
||||
end
|
||||
if
|
||||
nop
|
||||
end
|
||||
)
|
||||
(func $possibly-null/testLogicalOrMulti (; 16 ;) (type $FUNCSIG$vii) (param $0 i32) (param $1 i32)
|
||||
local.get $0
|
||||
i32.eqz
|
||||
if (result i32)
|
||||
i32.const 1
|
||||
else
|
||||
local.get $1
|
||||
i32.eqz
|
||||
end
|
||||
if
|
||||
nop
|
||||
else
|
||||
nop
|
||||
end
|
||||
)
|
||||
(func $null (; 17 ;) (type $FUNCSIG$v)
|
||||
)
|
||||
)
|
||||
|
Reference in New Issue
Block a user