From 4e58466b40b65cda399b4749105f0ce10f48f62b Mon Sep 17 00:00:00 2001 From: Thomas Lively Date: Fri, 8 Sep 2023 20:08:33 -0500 Subject: Make final types the default (#5918) Match the spec and parse the shorthand binary and text formats as final and emit final types without supertypes using the shorthands as well. This is a potentially-breaking change, since the text and binary shorthands can no longer be used to define types that have subtypes. Also make TypeBuilder entries final by default to better match the spec and update the internal APIs to use the "open" terminology rather than "final" terminology. Future changes will update the text format to use the standard "sub open" rather than the current "sub final" keywords. The exception is the new wat parser, which supporst "sub open" as of this change, since it didn't support final types at all previously. --- test/example/c-api-kitchen-sink.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'test/example/c-api-kitchen-sink.c') diff --git a/test/example/c-api-kitchen-sink.c b/test/example/c-api-kitchen-sink.c index 36e6776f7..c2c5d6e31 100644 --- a/test/example/c-api-kitchen-sink.c +++ b/test/example/c-api-kitchen-sink.c @@ -2160,6 +2160,7 @@ void test_typebuilder() { tempArrayType, BinaryenPackedTypeNotPacked(), true); + TypeBuilderSetOpen(builder, tempArrayIndex); // Create a recursive struct with a field of its own type const BinaryenIndex tempStructIndex = 1; @@ -2173,6 +2174,7 @@ void test_typebuilder() { bool fieldMutables[] = {true}; TypeBuilderSetStructType( builder, tempStructIndex, fieldTypes, fieldPackedTypes, fieldMutables, 1); + TypeBuilderSetOpen(builder, tempStructIndex); } // Create a recursive signature with parameter and result including its own @@ -2189,6 +2191,7 @@ void test_typebuilder() { tempSignatureIndex, TypeBuilderGetTempTupleType(builder, (BinaryenType*)¶mTypes, 2), tempSignatureType); + TypeBuilderSetOpen(builder, tempSignatureIndex); } // Create a subtype (with an additional immutable packed field) @@ -2209,11 +2212,10 @@ void test_typebuilder() { fieldPackedTypes, fieldMutables, 2); + TypeBuilderSetOpen(builder, tempSubStructIndex); } TypeBuilderSetSubType(builder, tempSubStructIndex, tempStructHeapType); - // TODO: Rtts (post-MVP?) - // Build the type hierarchy and dispose the builder BinaryenHeapType heapTypes[4]; BinaryenIndex errorIndex; -- cgit v1.2.3