diff options
Diffstat (limited to 'src/wasm-builder.h')
-rw-r--r-- | src/wasm-builder.h | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/wasm-builder.h b/src/wasm-builder.h index cca97a869..bd756297e 100644 --- a/src/wasm-builder.h +++ b/src/wasm-builder.h @@ -445,6 +445,21 @@ public: return makeConst(value); } + // Module-level helpers + + enum Mutability { + Mutable, + Immutable + }; + + static Global* makeGlobal(Name name, WasmType type, Expression* init, Mutability mutable_) { + auto* glob = new Global; + glob->name = name; + glob->type = type; + glob->init = init; + glob->mutable_ = mutable_ == Mutable; + return glob; + } }; } // namespace wasm |