summaryrefslogtreecommitdiff
path: root/src/wasm-builder.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/wasm-builder.h')
-rw-r--r--src/wasm-builder.h29
1 files changed, 17 insertions, 12 deletions
diff --git a/src/wasm-builder.h b/src/wasm-builder.h
index 50a6e97fb..e3b12d23f 100644
--- a/src/wasm-builder.h
+++ b/src/wasm-builder.h
@@ -727,9 +727,15 @@ public:
ret->finalize();
return ret;
}
- StructGet* makeStructGet() {
+ StructGet* makeStructGet(Index index,
+ Expression* value,
+ Type type,
+ bool signed_ = false) {
auto* ret = wasm.allocator.alloc<StructGet>();
- WASM_UNREACHABLE("TODO (gc): struct.get");
+ ret->index = index;
+ ret->value = value;
+ ret->type = type;
+ ret->signed_ = signed_;
ret->finalize();
return ret;
}
@@ -780,12 +786,12 @@ public:
if (type.isNumber()) {
return makeConst(value);
}
- if (type.isFunction()) {
- if (!value.isNull()) {
- return makeRefFunc(value.getFunc(), type);
- }
+ if (value.isNull()) {
return makeRefNull(type);
}
+ if (type.isFunction()) {
+ return makeRefFunc(value.getFunc(), type);
+ }
TODO_SINGLE_COMPOUND(type);
switch (type.getBasic()) {
case Type::externref:
@@ -962,13 +968,12 @@ public:
if (curr->type.isTuple()) {
return makeConstantExpression(Literal::makeZeros(curr->type));
}
+ if (curr->type.isNullable()) {
+ return ExpressionManipulator::refNull(curr, curr->type);
+ }
if (curr->type.isFunction()) {
- if (curr->type.isNullable()) {
- return ExpressionManipulator::refNull(curr, curr->type);
- } else {
- // We can't do any better, keep the original.
- return curr;
- }
+ // We can't do any better, keep the original.
+ return curr;
}
Literal value;
// TODO: reuse node conditionally when possible for literals