Commit df76f1e5 authored by Michael Starzinger's avatar Michael Starzinger Committed by Commit Bot

[wasm] Add test case for {WebAssembly.Function} re-export.

This just adds a test case checking against the current behavior, but
expectations might change once the proposal is clarified. For details
see: https://github.com/WebAssembly/js-types/issues/11

R=ahaas@chromium.org
TEST=mjsunit/wasm/type-reflection
BUG=v8:7742

Change-Id: I2fc502460c0a8094a414d138703b75497b2d1c6f
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1762517Reviewed-by: 's avatarAndreas Haas <ahaas@chromium.org>
Commit-Queue: Michael Starzinger <mstarzinger@chromium.org>
Cr-Commit-Position: refs/heads/master@{#63311}
parent 6d20778e
......@@ -558,3 +558,15 @@ load('test/mjsunit/wasm/wasm-module-builder.js');
() => builder.instantiate({ m: { fun: fun3 }}), WebAssembly.LinkError,
/imported function does not match the expected type/);
})();
(function TestFunctionModuleImportReExport () {
let builder = new WasmModuleBuilder();
let fun = new WebAssembly.Function({parameters:[], results:["i32"]}, _ => 7);
let fun_index = builder.addImport("m", "fun", kSig_i_v)
builder.addExport("fun1", fun_index);
builder.addExport("fun2", fun_index);
let instance = builder.instantiate({ m: { fun: fun }});
assertSame(instance.exports.fun1, instance.exports.fun2);
// TODO(7742): Fix after https://github.com/WebAssembly/js-types/issues/11.
assertNotSame(fun, instance.exports.fun1);
})();
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment