diff options
author | Heejin Ahn <aheejin@gmail.com> | 2019-05-24 15:02:42 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-05-24 15:02:42 -0700 |
commit | dc37d7b74edde1876f2114ad8edd10ab076e778f (patch) | |
tree | f9253c9b93ac7e544b29a594c96e1ba217b51d2d /src/js | |
parent | 7ae38053cf1e1e5c8f84c34a142efb043f6d4810 (diff) | |
download | binaryen-dc37d7b74edde1876f2114ad8edd10ab076e778f.tar.gz binaryen-dc37d7b74edde1876f2114ad8edd10ab076e778f.tar.bz2 binaryen-dc37d7b74edde1876f2114ad8edd10ab076e778f.zip |
Add `getGlobal` to binaryen.js (#2142)
We have `getFunction`, but not `getGlobal` because its name clashed with
APIs for the deprecated instruction `get_global`. Now we have reflected
instruction renaming in code, we can add it for consistency.
Diffstat (limited to 'src/js')
-rw-r--r-- | src/js/binaryen.js-post.js | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/js/binaryen.js-post.js b/src/js/binaryen.js-post.js index 6f0bec734..c64d3caca 100644 --- a/src/js/binaryen.js-post.js +++ b/src/js/binaryen.js-post.js @@ -1776,6 +1776,11 @@ function wrapModule(module, self) { return Module['_BinaryenAddGlobal'](module, strToStack(name), type, mutable, init); }); } + self['getGlobal'] = function(name) { + return preserveStack(function() { + return Module['_BinaryenGetGlobal'](module, strToStack(name)); + }); + }; self['removeGlobal'] = function(name) { return preserveStack(function() { return Module['_BinaryenRemoveGlobal'](module, strToStack(name)); |