diff options
Diffstat (limited to 'test/wasm2js/dynamicLibrary.2asm.js')
-rw-r--r-- | test/wasm2js/dynamicLibrary.2asm.js | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/test/wasm2js/dynamicLibrary.2asm.js b/test/wasm2js/dynamicLibrary.2asm.js index 9c58da101..13b52d003 100644 --- a/test/wasm2js/dynamicLibrary.2asm.js +++ b/test/wasm2js/dynamicLibrary.2asm.js @@ -1,6 +1,17 @@ import { memoryBase } from 'env'; import { tableBase } from 'env'; +function Table(ret) { + // grow method not included; table is not growable + ret.set = function(i, func) { + this[i] = func; + }; + ret.get = function(i) { + return this[i]; + }; + return ret; +} + function asmFunc(global, env, buffer) { var memory = env.memory; var HEAP8 = new global.Int8Array(buffer); @@ -37,7 +48,7 @@ function asmFunc(global, env, buffer) { } - var FUNCTION_TABLE = []; + var FUNCTION_TABLE = new Table(new Array(10)); FUNCTION_TABLE[import$tableBase + 0] = foo; FUNCTION_TABLE[import$tableBase + 1] = bar; function __wasm_memory_size() { @@ -45,7 +56,8 @@ function asmFunc(global, env, buffer) { } return { - "baz": baz + "baz": baz, + "tab": FUNCTION_TABLE }; } |