diff options
author | Alon Zakai <azakai@google.com> | 2023-01-26 16:11:24 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-01-26 16:11:24 -0800 |
commit | 0e4712f8dbbc43c6c55041e2359f24aa42ae0fdb (patch) | |
tree | d6ad070bb4030ea52e4881de276f8334adb2624d /src/wasm.h | |
parent | 07362b354b42b3c8cda2eff58fcaa9e74a2b2d18 (diff) | |
download | binaryen-0e4712f8dbbc43c6c55041e2359f24aa42ae0fdb.tar.gz binaryen-0e4712f8dbbc43c6c55041e2359f24aa42ae0fdb.tar.bz2 binaryen-0e4712f8dbbc43c6c55041e2359f24aa42ae0fdb.zip |
[Strings] Add experimental StringNew variants (#5459)
string.from_code_point makes a string from an int code point.
string.new_utf8*_try makes a utf8 string and returns null on a UTF8 encoding
error rather than trap.
Diffstat (limited to 'src/wasm.h')
-rw-r--r-- | src/wasm.h | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/wasm.h b/src/wasm.h index d5b52b315..779efe991 100644 --- a/src/wasm.h +++ b/src/wasm.h @@ -586,6 +586,8 @@ enum StringNewOp { StringNewWTF8Array, StringNewReplaceArray, StringNewWTF16Array, + // Other + StringNewFromCodePoint, }; enum StringMeasureOp { @@ -1684,7 +1686,7 @@ public: StringNewOp op; // In linear memory variations this is the pointer in linear memory. In the - // GC variations this is an Array. + // GC variations this is an Array. In from_codepoint this is the code point. Expression* ptr; // Used only in linear memory variations. @@ -1694,6 +1696,10 @@ public: Expression* start = nullptr; Expression* end = nullptr; + // The "try" variants will return null if an encoding error happens, rather + // than trap. + bool try_ = false; + void finalize(); }; |