diff options
Diffstat (limited to 'src/passes/LegalizeJSInterface.cpp')
-rw-r--r-- | src/passes/LegalizeJSInterface.cpp | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/src/passes/LegalizeJSInterface.cpp b/src/passes/LegalizeJSInterface.cpp index b52c1d330..cbd34e407 100644 --- a/src/passes/LegalizeJSInterface.cpp +++ b/src/passes/LegalizeJSInterface.cpp @@ -30,6 +30,7 @@ #include <pass.h> #include <wasm-builder.h> #include <ast_utils.h> +#include <ast/literal-utils.h> namespace wasm { @@ -226,12 +227,12 @@ private: void ensureTempRet0(Module* module) { if (!module->getGlobalOrNull(TEMP_RET_0)) { - Global* global = new Global; - global->name = TEMP_RET_0; - global->type = i32; - global->init = module->allocator.alloc<Const>()->set(Literal(int32_t(0))); - global->mutable_ = true; - module->addGlobal(global); + module->addGlobal(Builder::makeGlobal( + TEMP_RET_0, + i32, + LiteralUtils::makeZero(i32, *module), + Builder::Mutable + )); } } }; |