diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/passes/StringLowering.cpp | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/passes/StringLowering.cpp b/src/passes/StringLowering.cpp index 322f0deb2..df2d66860 100644 --- a/src/passes/StringLowering.cpp +++ b/src/passes/StringLowering.cpp @@ -298,6 +298,7 @@ struct StringLowering : public StringGathering { Name fromCharCodeArrayImport; Name intoCharCodeArrayImport; Name fromCodePointImport; + Name concatImport; Name equalsImport; Name compareImport; Name lengthImport; @@ -328,6 +329,8 @@ struct StringLowering : public StringGathering { module, "fromCharCodeArray", {nullArray16, Type::i32, Type::i32}, nnExt); // string.fromCodePoint: codepoint -> ext fromCodePointImport = addImport(module, "fromCodePoint", Type::i32, nnExt); + // string.concat: string, string -> string + concatImport = addImport(module, "concat", {nullExt, nullExt}, nnExt); // string.intoCharCodeArray: string, array, start -> num written intoCharCodeArrayImport = addImport(module, "intoCharCodeArray", @@ -375,6 +378,12 @@ struct StringLowering : public StringGathering { } } + void visitStringConcat(StringConcat* curr) { + Builder builder(*getModule()); + replaceCurrent(builder.makeCall( + lowering.concatImport, {curr->left, curr->right}, lowering.nnExt)); + } + void visitStringAs(StringAs* curr) { // There is no difference between strings and views with imported // strings: they are all just JS strings, so no conversion is needed. |