mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-31 05:09:12 +00:00
LibJS: Port ListFormat and PatternPartition to String
This commit is contained in:
parent
20536897e4
commit
1bcde5d216
Notes:
sideshowbarker
2024-07-17 09:56:35 +09:00
Author: https://github.com/trflynn89
Commit: 1bcde5d216
Pull-request: https://github.com/SerenityOS/serenity/pull/17122
Reviewed-by: https://github.com/Hendiadyoin1
Reviewed-by: https://github.com/nico
10 changed files with 53 additions and 54 deletions
|
@ -705,7 +705,7 @@ ThrowCompletionOr<Vector<PatternPartition>> partition_pattern(VM& vm, StringView
|
|||
auto literal = pattern.substring_view(next_index, *begin_index - next_index);
|
||||
|
||||
// ii. Append a new Record { [[Type]]: "literal", [[Value]]: literal } as the last element of the list result.
|
||||
TRY_OR_THROW_OOM(vm, result.try_append({ "literal"sv, literal }));
|
||||
TRY_OR_THROW_OOM(vm, result.try_append({ "literal"sv, TRY_OR_THROW_OOM(vm, String::from_utf8(literal)) }));
|
||||
}
|
||||
|
||||
// d. Let p be the substring of pattern from position beginIndex, exclusive, to position endIndex, exclusive.
|
||||
|
@ -727,7 +727,7 @@ ThrowCompletionOr<Vector<PatternPartition>> partition_pattern(VM& vm, StringView
|
|||
auto literal = pattern.substring_view(next_index);
|
||||
|
||||
// b. Append a new Record { [[Type]]: "literal", [[Value]]: literal } as the last element of the list result.
|
||||
TRY_OR_THROW_OOM(vm, result.try_append({ "literal"sv, literal }));
|
||||
TRY_OR_THROW_OOM(vm, result.try_append({ "literal"sv, TRY_OR_THROW_OOM(vm, String::from_utf8(literal)) }));
|
||||
}
|
||||
|
||||
// 8. Return result.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue