From 67019f9a72175bc7a098d72aa14a6f6afeb2efce Mon Sep 17 00:00:00 2001 From: Heejin Ahn Date: Mon, 13 May 2019 10:33:55 -0700 Subject: Add missing methods for globals to binaryen.js (#2099) - Print `globals` array in the tracing mode like other arrays (`functions`, `exports`, `imports`, ...) - Add accessor functions for globals --- src/js/binaryen.js-post.js | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'src/js/binaryen.js-post.js') diff --git a/src/js/binaryen.js-post.js b/src/js/binaryen.js-post.js index 52f4743bb..8aa28a08c 100644 --- a/src/js/binaryen.js-post.js +++ b/src/js/binaryen.js-post.js @@ -2327,12 +2327,14 @@ Module['getFunctionInfo'] = function(func) { }; // Obtains information about a 'Global' -Module['getGlobalInfo'] = function(func) { +Module['getGlobalInfo'] = function(global) { return { - 'name': UTF8ToString(Module['_BinaryenGlobalGetName'](func)), - 'module': UTF8ToString(Module['_BinaryenGlobalImportGetModule'](func)), - 'base': UTF8ToString(Module['_BinaryenGlobalImportGetBase'](func)), - 'type': UTF8ToString(Module['_BinaryenGlobalGetType'](func)) + 'name': UTF8ToString(Module['_BinaryenGlobalGetName'](global)), + 'module': UTF8ToString(Module['_BinaryenGlobalImportGetModule'](global)), + 'base': UTF8ToString(Module['_BinaryenGlobalImportGetBase'](global)), + 'type': Module['_BinaryenGlobalGetType'](global), + 'mutable': Boolean(Module['_BinaryenGlobalIsMutable'](global)), + 'init': Module['_BinaryenGlobalGetInitExpr'](global) }; }; -- cgit v1.2.3