diff options
author | Alon Zakai <azakai@google.com> | 2021-01-07 20:01:06 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-01-07 12:01:06 -0800 |
commit | 6a35e33f126d80e7583821e584ae9d101ba0ccb5 (patch) | |
tree | 3d339d81d52078bb97ba404d9f8bed348f6cbaa3 /src/wasm/wasm-binary.cpp | |
parent | 5693bc850110f2fd6c687f2b8753ec04f15d1f9e (diff) | |
download | binaryen-6a35e33f126d80e7583821e584ae9d101ba0ccb5.tar.gz binaryen-6a35e33f126d80e7583821e584ae9d101ba0ccb5.tar.bz2 binaryen-6a35e33f126d80e7583821e584ae9d101ba0ccb5.zip |
[GC] Fix parsing/printing of ref types using i31 (#3469)
This lets us parse (ref null i31) and (ref i31) and not just i31ref.
It also fixes the parsing of i31ref, making it nullable for now, which we
need to do until we support non-nullability.
Fix some internal handling of i31 where we had just i31ref (which meant we
just handled the non-nullable type).
After fixing a bug in printing (where we didn't print out (ref null i31)
properly), I found some a simplification, to remove TypeName.
Diffstat (limited to 'src/wasm/wasm-binary.cpp')
-rw-r--r-- | src/wasm/wasm-binary.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/wasm/wasm-binary.cpp b/src/wasm/wasm-binary.cpp index f3160c461..bcf7c15fe 100644 --- a/src/wasm/wasm-binary.cpp +++ b/src/wasm/wasm-binary.cpp @@ -1416,7 +1416,8 @@ Type WasmBinaryBuilder::getType(int initial) { // FIXME: for now, force all inputs to be nullable return Type(getHeapType(), Nullable); case BinaryConsts::EncodedType::i31ref: - return Type::i31ref; + // FIXME: for now, force all inputs to be nullable + return Type(HeapType::BasicHeapType::i31, Nullable); case BinaryConsts::EncodedType::rtt_n: { auto depth = getU32LEB(); auto heapType = getHeapType(); |