mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 19:57:35 +00:00
LibJS: Port ListFormat and PatternPartition to String
This commit is contained in:
parent
20536897e4
commit
1bcde5d216
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