1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 08:08:12 +00:00

LibJS: Port (most of) String.prototype to String

The locations that haven't been ported have a much wider footprint than
just the String.prototype files, so they've been left alone for now.
This commit is contained in:
Timothy Flynn 2023-01-14 10:40:08 -05:00 committed by Linus Groh
parent ceaec41726
commit 9f78e8728a
6 changed files with 73 additions and 70 deletions

View file

@ -140,14 +140,14 @@ ThrowCompletionOr<MarkedVector<Value>> StringObject::internal_own_property_keys(
// 5. For each integer i starting with 0 such that i < len, in ascending order, do
for (size_t i = 0; i < length; ++i) {
// a. Add ! ToString(𝔽(i)) as the last element of keys.
keys.append(PrimitiveString::create(vm, DeprecatedString::number(i)));
keys.append(PrimitiveString::create(vm, TRY_OR_THROW_OOM(vm, String::number(i))));
}
// 6. For each own property key P of O such that P is an array index and ! ToIntegerOrInfinity(P) ≥ len, in ascending numeric index order, do
for (auto& entry : indexed_properties()) {
if (entry.index() >= length) {
// a. Add P as the last element of keys.
keys.append(PrimitiveString::create(vm, DeprecatedString::number(entry.index())));
keys.append(PrimitiveString::create(vm, TRY_OR_THROW_OOM(vm, String::number(entry.index()))));
}
}