Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/compiler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10763,7 +10763,8 @@ export class Compiler extends DiagnosticEmitter {
case TypeKind.EXTERNREF: {
// TODO: non-null object might still be considered falseish
// i.e. a ref to Boolean(false), Number(0), String("") etc.
return module.unary(UnaryOp.EqzI32, module.ref_is_null(expr));
// TODO: return module.unary(UnaryOp.EqzI32, module.ref_is_null(expr));
assert(false, 'Truthy checks for externref are not yet supported');
}
default: {
assert(false);
Expand Down
15 changes: 0 additions & 15 deletions tests/compiler/features/reference-types.optimized.wat
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
(import "reference-types" "external" (func $features/reference-types/external (param externref) (result externref)))
(memory $0 1)
(data (i32.const 1024) "6\00\00\00\01\00\00\00\01\00\00\006\00\00\00f\00e\00a\00t\00u\00r\00e\00s\00/\00r\00e\00f\00e\00r\00e\00n\00c\00e\00-\00t\00y\00p\00e\00s\00.\00t\00s")
(global $features/reference-types/nullGlobal (mut externref) (ref.null))
(export "memory" (memory $0))
(export "external" (func $features/reference-types/external))
(export "internal" (func $features/reference-types/internal))
Expand Down Expand Up @@ -46,18 +45,4 @@
global.get $features/reference-types/someKey
call $~lib/bindings/Reflect/get
call $~lib/bindings/console/log
global.get $features/reference-types/nullGlobal
ref.is_null
i32.eqz
if
i32.const 0
i32.const 1040
i32.const 32
i32.const 1
call $~lib/builtins/abort
unreachable
end
ref.null
global.set $features/reference-types/nullGlobal
)
)
98 changes: 0 additions & 98 deletions tests/compiler/features/reference-types.untouched.wat
Original file line number Diff line number Diff line change
Expand Up @@ -15,19 +15,11 @@
(memory $0 1)
(data (i32.const 16) "6\00\00\00\01\00\00\00\01\00\00\006\00\00\00f\00e\00a\00t\00u\00r\00e\00s\00/\00r\00e\00f\00e\00r\00e\00n\00c\00e\00-\00t\00y\00p\00e\00s\00.\00t\00s\00")
(table $0 1 funcref)
(global $features/reference-types/nullGlobal (mut externref) (ref.null))
(global $features/reference-types/nullGlobalInit (mut externref) (ref.null))
(global $features/reference-types/funcGlobal (mut externref) (ref.null))
(export "memory" (memory $0))
(export "external" (func $features/reference-types/external))
(export "internal" (func $features/reference-types/internal))
(start $~start)
(func $features/reference-types/someFunc
nop
)
(func $start:features/reference-types
(local $0 externref)
(local $1 externref)
global.get $features/reference-types/someObject
global.get $features/reference-types/someKey
call $~lib/bindings/Reflect/has
Expand All @@ -50,96 +42,6 @@
global.get $features/reference-types/someKey
call $~lib/bindings/Reflect/get
call $~lib/bindings/console/log
global.get $features/reference-types/nullGlobal
ref.is_null
i32.eqz
i32.eqz
i32.eqz
if
i32.const 0
i32.const 32
i32.const 32
i32.const 1
call $~lib/builtins/abort
unreachable
end
ref.null
global.set $features/reference-types/nullGlobal
global.get $features/reference-types/nullGlobal
ref.is_null
i32.eqz
i32.eqz
i32.eqz
if
i32.const 0
i32.const 32
i32.const 34
i32.const 1
call $~lib/builtins/abort
unreachable
end
ref.null
global.set $features/reference-types/nullGlobalInit
global.get $features/reference-types/nullGlobalInit
ref.is_null
i32.eqz
i32.eqz
i32.eqz
if
i32.const 0
i32.const 32
i32.const 36
i32.const 1
call $~lib/builtins/abort
unreachable
end
local.get $0
ref.is_null
i32.eqz
i32.eqz
i32.eqz
if
i32.const 0
i32.const 32
i32.const 39
i32.const 3
call $~lib/builtins/abort
unreachable
end
ref.null
local.set $0
local.get $0
ref.is_null
i32.eqz
i32.eqz
i32.eqz
if
i32.const 0
i32.const 32
i32.const 41
i32.const 3
call $~lib/builtins/abort
unreachable
end
ref.null
local.set $1
local.get $1
ref.is_null
i32.eqz
i32.eqz
i32.eqz
if
i32.const 0
i32.const 32
i32.const 43
i32.const 3
call $~lib/builtins/abort
unreachable
end
ref.func $features/reference-types/someFunc
global.set $features/reference-types/funcGlobal
ref.func $features/reference-types/someFunc
local.set $1
)
(func $features/reference-types/internal (param $0 externref) (result externref)
(local $1 externref)
Expand Down