diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/wasm-builder.h | 4 | ||||
-rw-r--r-- | src/wasm/wasm.cpp | 4 |
2 files changed, 6 insertions, 2 deletions
diff --git a/src/wasm-builder.h b/src/wasm-builder.h index 4ef4b1e0b..7432562d1 100644 --- a/src/wasm-builder.h +++ b/src/wasm-builder.h @@ -164,14 +164,14 @@ public: auto* ret = allocator.alloc<SetLocal>(); ret->index = index; ret->value = value; - ret->type = none; + ret->finalize(); return ret; } SetLocal* makeTeeLocal(Index index, Expression* value) { auto* ret = allocator.alloc<SetLocal>(); ret->index = index; ret->value = value; - ret->type = value->type; + ret->setTee(true); return ret; } GetGlobal* makeGetGlobal(Name name, WasmType type) { diff --git a/src/wasm/wasm.cpp b/src/wasm/wasm.cpp index f82a06e68..ab2db6bd5 100644 --- a/src/wasm/wasm.cpp +++ b/src/wasm/wasm.cpp @@ -332,6 +332,10 @@ void SetLocal::setTee(bool is) { void SetLocal::finalize() { if (value->type == unreachable) { type = unreachable; + } else if (isTee()) { + type = value->type; + } else { + type = none; } } |