summaryrefslogtreecommitdiff
path: root/src/wasm/wasm-s-parser.cpp
diff options
context:
space:
mode:
authorThomas Lively <7121787+tlively@users.noreply.github.com>2022-08-17 22:51:27 -0700
committerGitHub <noreply@github.com>2022-08-17 22:51:27 -0700
commit2d86d1f8fb217456d8bcc4b401ce7d143aa36ee9 (patch)
treeec852da20ed85c7e5f9be7a5e3fb0632d7caf949 /src/wasm/wasm-s-parser.cpp
parent3aff4c6e85623c970280219c6699a66bc9de5f9b (diff)
downloadbinaryen-2d86d1f8fb217456d8bcc4b401ce7d143aa36ee9.tar.gz
binaryen-2d86d1f8fb217456d8bcc4b401ce7d143aa36ee9.tar.bz2
binaryen-2d86d1f8fb217456d8bcc4b401ce7d143aa36ee9.zip
Restore the `extern` heap type (#4898)
The GC proposal has split `any` and `extern` back into two separate types, so reintroduce `HeapType::ext` to represent `extern`. Before it was originally removed in #4633, externref was a subtype of anyref, but now it is not. Now that we have separate heaptype type hierarchies, make `HeapType::getLeastUpperBound` fallible as well.
Diffstat (limited to 'src/wasm/wasm-s-parser.cpp')
-rw-r--r--src/wasm/wasm-s-parser.cpp8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/wasm/wasm-s-parser.cpp b/src/wasm/wasm-s-parser.cpp
index 55551ef58..86d7b27e9 100644
--- a/src/wasm/wasm-s-parser.cpp
+++ b/src/wasm/wasm-s-parser.cpp
@@ -1169,8 +1169,10 @@ Type SExpressionWasmBuilder::stringToType(const char* str,
if (strncmp(str, "funcref", 7) == 0 && (prefix || str[7] == 0)) {
return Type(HeapType::func, Nullable);
}
- if ((strncmp(str, "externref", 9) == 0 && (prefix || str[9] == 0)) ||
- (strncmp(str, "anyref", 6) == 0 && (prefix || str[6] == 0))) {
+ if (strncmp(str, "externref", 9) == 0 && (prefix || str[9] == 0)) {
+ return Type(HeapType::ext, Nullable);
+ }
+ if (strncmp(str, "anyref", 6) == 0 && (prefix || str[6] == 0)) {
return Type(HeapType::any, Nullable);
}
if (strncmp(str, "eqref", 5) == 0 && (prefix || str[5] == 0)) {
@@ -1214,7 +1216,7 @@ HeapType SExpressionWasmBuilder::stringToHeapType(const char* str,
}
if (str[1] == 'x' && str[2] == 't' && str[3] == 'e' && str[4] == 'r' &&
str[5] == 'n' && (prefix || str[6] == 0)) {
- return HeapType::any;
+ return HeapType::ext;
}
}
if (str[0] == 'a') {