From da5035f893ce9e046f99cf3ede92b576024aa9da Mon Sep 17 00:00:00 2001 From: Thomas Lively <7121787+tlively@users.noreply.github.com> Date: Wed, 20 Jul 2022 20:13:18 -0700 Subject: Remove basic reference types (#4802) Basic reference types like `Type::funcref`, `Type::anyref`, etc. made it easy to accidentally forget to handle reference types with the same basic HeapTypes but the opposite nullability. In principle there is nothing special about the types with shorthands except in the binary and text formats. Removing these shorthands from the internal type representation by removing all basic reference types makes some code more complicated locally, but simplifies code globally and encourages properly handling both nullable and non-nullable reference types. --- test/binaryen.js/kitchen-sink.js | 18 ------------------ test/binaryen.js/kitchen-sink.js.txt | 12 ------------ 2 files changed, 30 deletions(-) (limited to 'test/binaryen.js') diff --git a/test/binaryen.js/kitchen-sink.js b/test/binaryen.js/kitchen-sink.js index ecfc73bff..6e5e19b2c 100644 --- a/test/binaryen.js/kitchen-sink.js +++ b/test/binaryen.js/kitchen-sink.js @@ -68,24 +68,6 @@ function test_types() { console.log(" // BinaryenTypeVec128: " + binaryen.v128); console.log(" //", binaryen.expandType(binaryen.v128).join(",")); - console.log(" // BinaryenTypeFuncref: " + binaryen.funcref); - console.log(" //", binaryen.expandType(binaryen.funcref).join(",")); - - console.log(" // BinaryenTypeExternref: " + binaryen.externref); - console.log(" //", binaryen.expandType(binaryen.externref).join(",")); - - console.log(" // BinaryenTypeAnyref: " + binaryen.anyref); - console.log(" //", binaryen.expandType(binaryen.anyref).join(",")); - - console.log(" // BinaryenTypeEqref: " + binaryen.eqref); - console.log(" //", binaryen.expandType(binaryen.eqref).join(",")); - - console.log(" // BinaryenTypeI31ref: " + binaryen.i31ref); - console.log(" //", binaryen.expandType(binaryen.i31ref).join(",")); - - console.log(" // BinaryenTypeDataref: " + binaryen.dataref); - console.log(" //", binaryen.expandType(binaryen.dataref).join(",")); - console.log(" // BinaryenTypeAuto: " + binaryen.auto); var i32_pair = binaryen.createType([binaryen.i32, binaryen.i32]); diff --git a/test/binaryen.js/kitchen-sink.js.txt b/test/binaryen.js/kitchen-sink.js.txt index 36b5c6749..f5b77234d 100644 --- a/test/binaryen.js/kitchen-sink.js.txt +++ b/test/binaryen.js/kitchen-sink.js.txt @@ -12,18 +12,6 @@ // 5 // BinaryenTypeVec128: 6 // 6 - // BinaryenTypeFuncref: 7 - // 7 - // BinaryenTypeExternref: 8 - // 8 - // BinaryenTypeAnyref: 8 - // 8 - // BinaryenTypeEqref: 9 - // 9 - // BinaryenTypeI31ref: 10 - // 10 - // BinaryenTypeDataref: 11 - // 11 // BinaryenTypeAuto: -1 // 2,2 // 2,2 -- cgit v1.2.3