diff options
author | Timothy Flynn <trflynn89@pm.me> | 2023-02-02 19:23:04 -0500 |
---|---|---|
committer | Linus Groh <mail@linusgroh.de> | 2023-02-08 18:32:37 +0000 |
commit | e86eafe65eaec4212f640d6a1ef6ee42cfb4ae1e (patch) | |
tree | 306e0f65e7011c2194f776ee716ea585b7038a5b /Userland/Libraries/LibJS/Runtime/Intl/DurationFormat.cpp | |
parent | 951a8269f0acf4741be91afcc8542bc9c511e424 (diff) | |
download | serenity-e86eafe65eaec4212f640d6a1ef6ee42cfb4ae1e.zip |
LibJS: Replace remaining uses of StringBuilder in the Intl namespace
Diffstat (limited to 'Userland/Libraries/LibJS/Runtime/Intl/DurationFormat.cpp')
-rw-r--r-- | Userland/Libraries/LibJS/Runtime/Intl/DurationFormat.cpp | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/Userland/Libraries/LibJS/Runtime/Intl/DurationFormat.cpp b/Userland/Libraries/LibJS/Runtime/Intl/DurationFormat.cpp index f7cfc73856..12bf0406a3 100644 --- a/Userland/Libraries/LibJS/Runtime/Intl/DurationFormat.cpp +++ b/Userland/Libraries/LibJS/Runtime/Intl/DurationFormat.cpp @@ -15,6 +15,7 @@ #include <LibJS/Runtime/Intl/PluralRulesConstructor.h> #include <LibJS/Runtime/Intl/RelativeTimeFormat.h> #include <LibJS/Runtime/Temporal/AbstractOperations.h> +#include <LibJS/Runtime/ThrowableStringBuilder.h> namespace JS::Intl { @@ -507,16 +508,16 @@ ThrowCompletionOr<Vector<PatternPartition>> partition_duration_format_pattern(VM auto parts = MUST_OR_THROW_OOM(partition_number_pattern(vm, *number_format, MathematicalValue(value))); // 6. Let concat be an empty String. - StringBuilder concat; + ThrowableStringBuilder concat(vm); // 7. For each Record { [[Type]], [[Value]], [[Unit]] } part in parts, do for (auto const& part : parts) { // a. Set concat to the string-concatenation of concat and part.[[Value]]. - concat.append(part.value); + TRY(concat.append(part.value)); } // 8. Append the new Record { [[Type]]: unit, [[Value]]: concat } to the end of result. - result.append({ unit, TRY_OR_THROW_OOM(vm, concat.to_string()) }); + result.append({ unit, MUST_OR_THROW_OOM(concat.to_string()) }); } } } |