From 192757772adce7568fc1f3f3e733a4263b6392c6 Mon Sep 17 00:00:00 2001 From: Daniel Wirtz Date: Fri, 11 Sep 2020 03:04:17 +0200 Subject: Add anyref feature and type (#3109) Adds `anyref` type, which is enabled by a new feature `--enable-anyref`. This type is primarily used for testing that passes correctly handle subtype relationships so that the codebase will continue to be prepared for future subtyping. Since `--enable-anyref` is meaningless without also using `--enable-reference-types`, this PR also makes it a validation error to pass only the former (and similarly makes it a validation error to enable exception handling without enabling reference types). --- src/js/binaryen.js-post.js | 8 ++++++++ 1 file changed, 8 insertions(+) (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 66de10848..fd121b8af 100644 --- a/src/js/binaryen.js-post.js +++ b/src/js/binaryen.js-post.js @@ -36,6 +36,7 @@ function initializeConstants() { ['funcref', 'Funcref'], ['externref', 'Externref'], ['exnref', 'Exnref'], + ['anyref', 'Anyref'], ['unreachable', 'Unreachable'], ['auto', 'Auto'] ].forEach(entry => { @@ -120,6 +121,7 @@ function initializeConstants() { 'TailCall', 'ReferenceTypes', 'Multivalue', + 'Anyref', 'All' ].forEach(name => { Module['Features'][name] = Module['_BinaryenFeature' + name](); @@ -2063,6 +2065,12 @@ function wrapModule(module, self = {}) { } }; + self['anyref'] = { + 'pop'() { + return Module['_BinaryenPop'](module, Module['anyref']); + } + }; + self['ref'] = { 'null'(type) { return Module['_BinaryenRefNull'](module, type); -- cgit v1.2.3