Revert "LibJS+LibWeb: Return Vector<PropertyKey> from…
Some checks are pending
CI / Lagom (arm64, Sanitizer_CI, false, macos-15, macOS, Clang) (push) Waiting to run
CI / Lagom (x86_64, Fuzzers_CI, false, ubuntu-24.04, Linux, Clang) (push) Waiting to run
CI / Lagom (x86_64, Sanitizer_CI, false, ubuntu-24.04, Linux, GNU) (push) Waiting to run
CI / Lagom (x86_64, Sanitizer_CI, true, ubuntu-24.04, Linux, Clang) (push) Waiting to run
Package the js repl as a binary artifact / build-and-package (arm64, macos-15, macOS, macOS-universal2) (push) Waiting to run
Package the js repl as a binary artifact / build-and-package (x86_64, ubuntu-24.04, Linux, Linux-x86_64) (push) Waiting to run
Run test262 and test-wasm / run_and_update_results (push) Waiting to run
Lint Code / lint (push) Waiting to run
Label PRs with merge conflicts / auto-labeler (push) Waiting to run
Push notes / build (push) Waiting to run

internal_own_property_keys"

This reverts commit 5ee810f772.
This commit is contained in:
Tim Ledbetter 2025-05-16 04:14:12 +01:00 committed by Tim Ledbetter
commit 2903defcfc
Notes: github-actions[bot] 2025-05-16 05:34:06 +00:00
24 changed files with 155 additions and 134 deletions

View file

@ -105,11 +105,11 @@ static ThrowCompletionOr<GC::RootVector<Value>> get_own_property_keys(VM& vm, Va
auto name_list = GC::RootVector<Value> { vm.heap() };
// 4. For each element nextKey of keys, do
for (auto& next_property_key : keys) {
for (auto& next_key : keys) {
// a. If Type(nextKey) is Symbol and type is symbol or Type(nextKey) is String and type is string, then
if ((next_property_key.is_symbol() && type == GetOwnPropertyKeysType::Symbol) || ((next_property_key.is_string() || next_property_key.is_number()) && type == GetOwnPropertyKeysType::String)) {
if ((next_key.is_symbol() && type == GetOwnPropertyKeysType::Symbol) || (next_key.is_string() && type == GetOwnPropertyKeysType::String)) {
// i. Append nextKey as the last element of nameList.
name_list.append(next_property_key.to_value(vm));
name_list.append(next_key);
}
}
@ -142,19 +142,21 @@ JS_DEFINE_NATIVE_FUNCTION(ObjectConstructor::assign)
auto keys = TRY(from->internal_own_property_keys());
// iii. For each element nextKey of keys, do
for (auto& next_property_key : keys) {
for (auto& next_key : keys) {
auto property_key = MUST(PropertyKey::from_value(vm, next_key));
// 1. Let desc be ? from.[[GetOwnProperty]](nextKey).
auto desc = TRY(from->internal_get_own_property(next_property_key));
auto desc = TRY(from->internal_get_own_property(property_key));
// 2. If desc is not undefined and desc.[[Enumerable]] is true, then
if (!desc.has_value() || !*desc->enumerable)
continue;
// a. Let propValue be ? Get(from, nextKey).
auto prop_value = TRY(from->get(next_property_key));
auto prop_value = TRY(from->get(property_key));
// b. Perform ? Set(to, nextKey, propValue, true).
TRY(to->set(next_property_key, prop_value, Object::ShouldThrowExceptions::Yes));
TRY(to->set(property_key, prop_value, Object::ShouldThrowExceptions::Yes));
}
}
@ -325,7 +327,9 @@ JS_DEFINE_NATIVE_FUNCTION(ObjectConstructor::get_own_property_descriptors)
auto descriptors = Object::create(realm, realm.intrinsics().object_prototype());
// 4. For each element key of ownKeys, do
for (auto& property_key : own_keys) {
for (auto& key : own_keys) {
auto property_key = MUST(PropertyKey::from_value(vm, key));
// a. Let desc be ? obj.[[GetOwnProperty]](key).
auto desc = TRY(object->internal_get_own_property(property_key));