summaryrefslogtreecommitdiff
path: root/Libraries/LibJS
diff options
context:
space:
mode:
Diffstat (limited to 'Libraries/LibJS')
-rw-r--r--Libraries/LibJS/AST.cpp2
-rw-r--r--Libraries/LibJS/Runtime/Object.cpp14
-rw-r--r--Libraries/LibJS/Runtime/Object.h4
-rw-r--r--Libraries/LibJS/Runtime/ObjectConstructor.cpp6
-rw-r--r--Libraries/LibJS/Runtime/ReflectObject.cpp2
5 files changed, 14 insertions, 14 deletions
diff --git a/Libraries/LibJS/AST.cpp b/Libraries/LibJS/AST.cpp
index f1b1cd45bb..86e13095f5 100644
--- a/Libraries/LibJS/AST.cpp
+++ b/Libraries/LibJS/AST.cpp
@@ -383,7 +383,7 @@ Value ForInStatement::execute(Interpreter& interpreter, GlobalObject& global_obj
return {};
auto* object = rhs_result.to_object(interpreter, global_object);
while (object) {
- auto property_names = object->get_own_properties(*object, Object::GetOwnPropertyReturnMode::Key, true);
+ auto property_names = object->get_own_properties(*object, Object::PropertyKind::Key, true);
for (auto& property_name : property_names.as_object().indexed_properties()) {
interpreter.set_variable(variable_name, property_name.value_and_attributes(object).value, global_object);
if (interpreter.exception())
diff --git a/Libraries/LibJS/Runtime/Object.cpp b/Libraries/LibJS/Runtime/Object.cpp
index ab140feba3..e502c4e205 100644
--- a/Libraries/LibJS/Runtime/Object.cpp
+++ b/Libraries/LibJS/Runtime/Object.cpp
@@ -179,7 +179,7 @@ Value Object::get_own_property(const Object& this_object, PropertyName property_
return value_here;
}
-Value Object::get_own_properties(const Object& this_object, GetOwnPropertyReturnMode kind, bool only_enumerable_properties, GetOwnPropertyReturnType return_type) const
+Value Object::get_own_properties(const Object& this_object, PropertyKind kind, bool only_enumerable_properties, GetOwnPropertyReturnType return_type) const
{
auto* properties_array = Array::create(global_object());
@@ -188,9 +188,9 @@ Value Object::get_own_properties(const Object& this_object, GetOwnPropertyReturn
auto str = static_cast<const StringObject&>(this_object).primitive_string().string();
for (size_t i = 0; i < str.length(); ++i) {
- if (kind == GetOwnPropertyReturnMode::Key) {
+ if (kind == PropertyKind::Key) {
properties_array->define_property(i, js_string(interpreter(), String::number(i)));
- } else if (kind == GetOwnPropertyReturnMode::Value) {
+ } else if (kind == PropertyKind::Value) {
properties_array->define_property(i, js_string(interpreter(), String::format("%c", str[i])));
} else {
auto* entry_array = Array::create(global_object());
@@ -211,9 +211,9 @@ Value Object::get_own_properties(const Object& this_object, GetOwnPropertyReturn
if (only_enumerable_properties && !value_and_attributes.attributes.is_enumerable())
continue;
- if (kind == GetOwnPropertyReturnMode::Key) {
+ if (kind == PropertyKind::Key) {
properties_array->define_property(property_index, js_string(interpreter(), String::number(entry.index())));
- } else if (kind == GetOwnPropertyReturnMode::Value) {
+ } else if (kind == PropertyKind::Value) {
properties_array->define_property(property_index, value_and_attributes.value);
} else {
auto* entry_array = Array::create(global_object());
@@ -236,9 +236,9 @@ Value Object::get_own_properties(const Object& this_object, GetOwnPropertyReturn
if (return_type == GetOwnPropertyReturnType::SymbolOnly && it.key.is_string())
continue;
- if (kind == GetOwnPropertyReturnMode::Key) {
+ if (kind == PropertyKind::Key) {
properties_array->define_property(property_index, it.key.to_value(interpreter()));
- } else if (kind == GetOwnPropertyReturnMode::Value) {
+ } else if (kind == PropertyKind::Value) {
properties_array->define_property(property_index, this_object.get(it.key));
} else {
auto* entry_array = Array::create(global_object());
diff --git a/Libraries/LibJS/Runtime/Object.h b/Libraries/LibJS/Runtime/Object.h
index 082c5fff57..507795ce1e 100644
--- a/Libraries/LibJS/Runtime/Object.h
+++ b/Libraries/LibJS/Runtime/Object.h
@@ -68,7 +68,7 @@ public:
virtual bool inherits(const StringView& class_name) const { return class_name == this->class_name(); }
- enum class GetOwnPropertyReturnMode {
+ enum class PropertyKind {
Key,
Value,
KeyAndValue,
@@ -97,7 +97,7 @@ public:
virtual bool put(const PropertyName&, Value, Value receiver = {});
Value get_own_property(const Object& this_object, PropertyName, Value receiver) const;
- Value get_own_properties(const Object& this_object, GetOwnPropertyReturnMode, bool only_enumerable_properties = false, GetOwnPropertyReturnType = GetOwnPropertyReturnType::StringOnly) const;
+ Value get_own_properties(const Object& this_object, PropertyKind, bool only_enumerable_properties = false, GetOwnPropertyReturnType = GetOwnPropertyReturnType::StringOnly) const;
virtual Optional<PropertyDescriptor> get_own_property_descriptor(const PropertyName&) const;
Value get_own_property_descriptor_object(const PropertyName&) const;
diff --git a/Libraries/LibJS/Runtime/ObjectConstructor.cpp b/Libraries/LibJS/Runtime/ObjectConstructor.cpp
index ca6de93616..cd158f87c1 100644
--- a/Libraries/LibJS/Runtime/ObjectConstructor.cpp
+++ b/Libraries/LibJS/Runtime/ObjectConstructor.cpp
@@ -198,7 +198,7 @@ JS_DEFINE_NATIVE_FUNCTION(ObjectConstructor::keys)
if (interpreter.exception())
return {};
- return obj_arg->get_own_properties(*obj_arg, GetOwnPropertyReturnMode::Key, true);
+ return obj_arg->get_own_properties(*obj_arg, PropertyKind::Key, true);
}
JS_DEFINE_NATIVE_FUNCTION(ObjectConstructor::values)
@@ -210,7 +210,7 @@ JS_DEFINE_NATIVE_FUNCTION(ObjectConstructor::values)
if (interpreter.exception())
return {};
- return obj_arg->get_own_properties(*obj_arg, GetOwnPropertyReturnMode::Value, true);
+ return obj_arg->get_own_properties(*obj_arg, PropertyKind::Value, true);
}
JS_DEFINE_NATIVE_FUNCTION(ObjectConstructor::entries)
@@ -222,7 +222,7 @@ JS_DEFINE_NATIVE_FUNCTION(ObjectConstructor::entries)
if (interpreter.exception())
return {};
- return obj_arg->get_own_properties(*obj_arg, GetOwnPropertyReturnMode::KeyAndValue, true);
+ return obj_arg->get_own_properties(*obj_arg, PropertyKind::KeyAndValue, true);
}
}
diff --git a/Libraries/LibJS/Runtime/ReflectObject.cpp b/Libraries/LibJS/Runtime/ReflectObject.cpp
index 965a04fb0d..95357fe30c 100644
--- a/Libraries/LibJS/Runtime/ReflectObject.cpp
+++ b/Libraries/LibJS/Runtime/ReflectObject.cpp
@@ -233,7 +233,7 @@ JS_DEFINE_NATIVE_FUNCTION(ReflectObject::own_keys)
auto* target = get_target_object_from(interpreter, "ownKeys");
if (!target)
return {};
- return target->get_own_properties(*target, GetOwnPropertyReturnMode::Key);
+ return target->get_own_properties(*target, PropertyKind::Key);
}
JS_DEFINE_NATIVE_FUNCTION(ReflectObject::prevent_extensions)