summaryrefslogtreecommitdiff
path: root/test/example/c-api-kitchen-sink.c
diff options
context:
space:
mode:
authorThomas Lively <tlively@google.com>2023-09-08 20:08:33 -0500
committerGitHub <noreply@github.com>2023-09-09 01:08:33 +0000
commit4e58466b40b65cda399b4749105f0ce10f48f62b (patch)
tree9e34ae5ed464d87d75683603171e7b2645015568 /test/example/c-api-kitchen-sink.c
parent90571051b3d6f89eab184df3d4dd716472a6cd7c (diff)
downloadbinaryen-4e58466b40b65cda399b4749105f0ce10f48f62b.tar.gz
binaryen-4e58466b40b65cda399b4749105f0ce10f48f62b.tar.bz2
binaryen-4e58466b40b65cda399b4749105f0ce10f48f62b.zip
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.
Diffstat (limited to 'test/example/c-api-kitchen-sink.c')
-rw-r--r--test/example/c-api-kitchen-sink.c6
1 files changed, 4 insertions, 2 deletions
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*)&paramTypes, 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;