mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-25 09:00:22 +00:00
LibJS: Propagate OOM from Intl.RelativeTimeFormat Vector operations
This commit is contained in:
parent
cb8b2209c1
commit
9af525bbb0
Notes:
sideshowbarker
2024-07-17 12:02:22 +09:00
Author: https://github.com/trflynn89 Commit: https://github.com/SerenityOS/serenity/commit/9af525bbb0 Pull-request: https://github.com/SerenityOS/serenity/pull/17290 Reviewed-by: https://github.com/linusg ✅
1 changed files with 5 additions and 3 deletions
|
@ -151,7 +151,9 @@ ThrowCompletionOr<Vector<PatternPartitionWithUnit>> partition_relative_time_patt
|
|||
auto result = TRY_OR_THROW_OOM(vm, String::from_utf8(patterns[0].pattern));
|
||||
|
||||
// ii. Return a List containing the Record { [[Type]]: "literal", [[Value]]: result }.
|
||||
return Vector<PatternPartitionWithUnit> { { "literal"sv, move(result) } };
|
||||
Vector<PatternPartitionWithUnit> result_list;
|
||||
TRY_OR_THROW_OOM(vm, result_list.try_empend("literal"sv, move(result)));
|
||||
return result_list;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -202,7 +204,7 @@ ThrowCompletionOr<Vector<PatternPartitionWithUnit>> make_parts_list(VM& vm, Stri
|
|||
// a. If patternPart.[[Type]] is "literal", then
|
||||
if (pattern_part.type == "literal"sv) {
|
||||
// i. Append Record { [[Type]]: "literal", [[Value]]: patternPart.[[Value]], [[Unit]]: empty } to result.
|
||||
result.empend("literal"sv, move(pattern_part.value));
|
||||
TRY_OR_THROW_OOM(vm, result.try_empend("literal"sv, move(pattern_part.value)));
|
||||
}
|
||||
// b. Else,
|
||||
else {
|
||||
|
@ -212,7 +214,7 @@ ThrowCompletionOr<Vector<PatternPartitionWithUnit>> make_parts_list(VM& vm, Stri
|
|||
// ii. For each Record { [[Type]], [[Value]] } part in parts, do
|
||||
for (auto& part : parts) {
|
||||
// 1. Append Record { [[Type]]: part.[[Type]], [[Value]]: part.[[Value]], [[Unit]]: unit } to result.
|
||||
result.empend(part.type, move(part.value), unit);
|
||||
TRY_OR_THROW_OOM(vm, result.try_empend(part.type, move(part.value), unit));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue