diff options
author | Thomas Lively <tlively@google.com> | 2024-02-26 22:54:32 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-02-26 22:54:32 -0800 |
commit | 063e1a2ea8e8fb5f9fa7a24c0a3ce559d6b6331c (patch) | |
tree | 011d4665360d394fba9612bc1c20f6f1be8e7326 /src/passes/StringLowering.cpp | |
parent | f8b07f75996b34142450435c75a811aa946a6d3b (diff) | |
download | binaryen-063e1a2ea8e8fb5f9fa7a24c0a3ce559d6b6331c.tar.gz binaryen-063e1a2ea8e8fb5f9fa7a24c0a3ce559d6b6331c.tar.bz2 binaryen-063e1a2ea8e8fb5f9fa7a24c0a3ce559d6b6331c.zip |
[StringLowering] Lower `stringview_wtf16.get_codeunit` to `charCodeAt` (#6353)
Previously we lowered this to `getCodePointAt`, which has different semantics
around surrogate pairs.
Diffstat (limited to 'src/passes/StringLowering.cpp')
-rw-r--r-- | src/passes/StringLowering.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/passes/StringLowering.cpp b/src/passes/StringLowering.cpp index c04695c50..1e16295cd 100644 --- a/src/passes/StringLowering.cpp +++ b/src/passes/StringLowering.cpp @@ -295,7 +295,7 @@ struct StringLowering : public StringGathering { Name equalsImport; Name compareImport; Name lengthImport; - Name codePointAtImport; + Name charCodeAtImport; Name substringImport; // The name of the module to import string functions from. @@ -334,8 +334,8 @@ struct StringLowering : public StringGathering { // string.length: string -> i32 lengthImport = addImport(module, "length", nullExt, Type::i32); // string.codePointAt: string, offset -> i32 - codePointAtImport = - addImport(module, "codePointAt", {nullExt, Type::i32}, Type::i32); + charCodeAtImport = + addImport(module, "charCodeAt", {nullExt, Type::i32}, Type::i32); // string.substring: string, start, end -> string substringImport = addImport(module, "substring", {nullExt, Type::i32, Type::i32}, nnExt); @@ -425,7 +425,7 @@ struct StringLowering : public StringGathering { void visitStringWTF16Get(StringWTF16Get* curr) { Builder builder(*getModule()); replaceCurrent(builder.makeCall( - lowering.codePointAtImport, {curr->ref, curr->pos}, Type::i32)); + lowering.charCodeAtImport, {curr->ref, curr->pos}, Type::i32)); } void visitStringSliceWTF(StringSliceWTF* curr) { |