summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibJS/Runtime
diff options
context:
space:
mode:
Diffstat (limited to 'Userland/Libraries/LibJS/Runtime')
-rw-r--r--Userland/Libraries/LibJS/Runtime/ArrayPrototype.cpp24
-rw-r--r--Userland/Libraries/LibJS/Runtime/GeneratorObject.cpp10
-rw-r--r--Userland/Libraries/LibJS/Runtime/Object.h3
-rw-r--r--Userland/Libraries/LibJS/Runtime/ObjectEnvironment.cpp2
-rw-r--r--Userland/Libraries/LibJS/Runtime/TypedArrayConstructor.cpp2
-rw-r--r--Userland/Libraries/LibJS/Runtime/VM.cpp4
6 files changed, 21 insertions, 24 deletions
diff --git a/Userland/Libraries/LibJS/Runtime/ArrayPrototype.cpp b/Userland/Libraries/LibJS/Runtime/ArrayPrototype.cpp
index 25b97c5ede..c192404548 100644
--- a/Userland/Libraries/LibJS/Runtime/ArrayPrototype.cpp
+++ b/Userland/Libraries/LibJS/Runtime/ArrayPrototype.cpp
@@ -369,7 +369,7 @@ JS_DEFINE_NATIVE_FUNCTION(ArrayPrototype::push)
return {};
}
auto new_length_value = Value((i32)new_length);
- this_object->put(vm.names.length, new_length_value);
+ this_object->set(vm.names.length, new_length_value, true);
if (vm.exception())
return {};
return new_length_value;
@@ -420,7 +420,7 @@ JS_DEFINE_NATIVE_FUNCTION(ArrayPrototype::unshift)
}
}
- this_object->put(vm.names.length, Value(new_length));
+ this_object->set(vm.names.length, Value(new_length), true);
if (vm.exception())
return {};
return Value(new_length);
@@ -442,7 +442,7 @@ JS_DEFINE_NATIVE_FUNCTION(ArrayPrototype::pop)
if (vm.exception())
return {};
if (length == 0) {
- this_object->put(vm.names.length, Value(0));
+ this_object->set(vm.names.length, Value(0), true);
return js_undefined();
}
auto index = length - 1;
@@ -452,7 +452,7 @@ JS_DEFINE_NATIVE_FUNCTION(ArrayPrototype::pop)
this_object->delete_property_or_throw(index);
if (vm.exception())
return {};
- this_object->put(vm.names.length, Value((i32)index));
+ this_object->set(vm.names.length, Value((i32)index), true);
if (vm.exception())
return {};
return element;
@@ -468,7 +468,7 @@ JS_DEFINE_NATIVE_FUNCTION(ArrayPrototype::shift)
if (vm.exception())
return {};
if (length == 0) {
- this_object->put(vm.names.length, Value(0));
+ this_object->set(vm.names.length, Value(0), true);
if (vm.exception())
return {};
return js_undefined();
@@ -501,7 +501,7 @@ JS_DEFINE_NATIVE_FUNCTION(ArrayPrototype::shift)
if (vm.exception())
return {};
- this_object->put(vm.names.length, Value(length - 1));
+ this_object->set(vm.names.length, Value(length - 1), true);
if (vm.exception())
return {};
return first;
@@ -693,7 +693,7 @@ JS_DEFINE_NATIVE_FUNCTION(ArrayPrototype::concat)
return {};
}
- new_array->put(vm.names.length, Value(n));
+ new_array->set(vm.names.length, Value(n), true);
if (vm.exception())
return {};
return Value(new_array);
@@ -769,7 +769,7 @@ JS_DEFINE_NATIVE_FUNCTION(ArrayPrototype::slice)
++index;
}
- new_array->put(vm.names.length, Value(index));
+ new_array->set(vm.names.length, Value(index), true);
if (vm.exception())
return {};
@@ -1675,7 +1675,7 @@ JS_DEFINE_NATIVE_FUNCTION(ArrayPrototype::splice)
}
}
- removed_elements->put(vm.names.length, Value(actual_delete_count));
+ removed_elements->set(vm.names.length, Value(actual_delete_count), true);
if (vm.exception())
return {};
@@ -1725,7 +1725,7 @@ JS_DEFINE_NATIVE_FUNCTION(ArrayPrototype::splice)
return {};
}
- this_object->put(vm.names.length, Value((i32)new_length));
+ this_object->set(vm.names.length, Value((i32)new_length), true);
if (vm.exception())
return {};
@@ -1771,7 +1771,7 @@ JS_DEFINE_NATIVE_FUNCTION(ArrayPrototype::fill)
to = min(relative_end, length);
for (size_t i = from; i < to; i++) {
- this_object->put(i, vm.argument(0));
+ this_object->set(i, vm.argument(0), true);
if (vm.exception())
return {};
}
@@ -1988,7 +1988,7 @@ JS_DEFINE_NATIVE_FUNCTION(ArrayPrototype::copy_within)
auto from_value = this_object->get(from_i);
if (vm.exception())
return {};
- this_object->put(to_i, from_value);
+ this_object->set(to_i, from_value, true);
if (vm.exception())
return {};
} else {
diff --git a/Userland/Libraries/LibJS/Runtime/GeneratorObject.cpp b/Userland/Libraries/LibJS/Runtime/GeneratorObject.cpp
index 351e094fa3..2b4529737b 100644
--- a/Userland/Libraries/LibJS/Runtime/GeneratorObject.cpp
+++ b/Userland/Libraries/LibJS/Runtime/GeneratorObject.cpp
@@ -73,10 +73,10 @@ Value GeneratorObject::next_impl(VM& vm, GlobalObject& global_object, Optional<V
return {};
auto result = Object::create(global_object, global_object.object_prototype());
- result->put("value", previous_generated_value);
+ result->define_direct_property("value", previous_generated_value, JS::default_attributes);
if (m_done) {
- result->put("done", Value(true));
+ result->define_direct_property("done", Value(true), JS::default_attributes);
return result;
}
@@ -88,7 +88,7 @@ Value GeneratorObject::next_impl(VM& vm, GlobalObject& global_object, Optional<V
if (!next_block) {
// The generator has terminated, now we can simply return done=true.
m_done = true;
- result->put("done", Value(true));
+ result->define_direct_property("done", Value(true), JS::default_attributes);
return result;
}
@@ -115,8 +115,8 @@ Value GeneratorObject::next_impl(VM& vm, GlobalObject& global_object, Optional<V
m_done = generated_continuation(m_previous_value) == nullptr;
- result->put("value", generated_value(m_previous_value));
- result->put("done", Value(m_done));
+ result->define_direct_property("value", generated_value(m_previous_value), JS::default_attributes);
+ result->define_direct_property("done", Value(m_done), JS::default_attributes);
if (vm.exception())
return {};
diff --git a/Userland/Libraries/LibJS/Runtime/Object.h b/Userland/Libraries/LibJS/Runtime/Object.h
index d36a117089..178fe4c3c6 100644
--- a/Userland/Libraries/LibJS/Runtime/Object.h
+++ b/Userland/Libraries/LibJS/Runtime/Object.h
@@ -123,9 +123,6 @@ public:
// Non-standard methods
- // - Helpers using old, non-standard names but wrapping the standard methods.
- // FIXME: Update all the code relying on these and remove them.
- bool put(PropertyName const& property_name, Value value, Value receiver = {}) { return internal_set(property_name, value, receiver.value_or(this)); }
Value get_without_side_effects(const PropertyName&) const;
void define_direct_property(PropertyName const& property_name, Value value, PropertyAttributes attributes) { storage_set(property_name, { value, attributes }); };
diff --git a/Userland/Libraries/LibJS/Runtime/ObjectEnvironment.cpp b/Userland/Libraries/LibJS/Runtime/ObjectEnvironment.cpp
index 5a30b09c1e..7e13e2980a 100644
--- a/Userland/Libraries/LibJS/Runtime/ObjectEnvironment.cpp
+++ b/Userland/Libraries/LibJS/Runtime/ObjectEnvironment.cpp
@@ -34,7 +34,7 @@ Optional<Variable> ObjectEnvironment::get_from_environment(FlyString const& name
bool ObjectEnvironment::put_into_environment(FlyString const& name, Variable variable)
{
- return m_binding_object.put(name, variable.value);
+ return m_binding_object.set(name, variable.value, false);
}
bool ObjectEnvironment::delete_from_environment(FlyString const& name)
diff --git a/Userland/Libraries/LibJS/Runtime/TypedArrayConstructor.cpp b/Userland/Libraries/LibJS/Runtime/TypedArrayConstructor.cpp
index 4402529fdb..fd31118585 100644
--- a/Userland/Libraries/LibJS/Runtime/TypedArrayConstructor.cpp
+++ b/Userland/Libraries/LibJS/Runtime/TypedArrayConstructor.cpp
@@ -180,7 +180,7 @@ JS_DEFINE_NATIVE_FUNCTION(TypedArrayConstructor::of)
if (vm.exception())
return {};
for (size_t k = 0; k < length; ++k) {
- auto success = new_object->put(k, vm.argument(k));
+ auto success = new_object->set(k, vm.argument(k), true);
if (vm.exception())
return {};
if (!success) {
diff --git a/Userland/Libraries/LibJS/Runtime/VM.cpp b/Userland/Libraries/LibJS/Runtime/VM.cpp
index 031c1a72c5..fe04633b22 100644
--- a/Userland/Libraries/LibJS/Runtime/VM.cpp
+++ b/Userland/Libraries/LibJS/Runtime/VM.cpp
@@ -160,7 +160,7 @@ void VM::set_variable(const FlyString& name, Value value, GlobalObject& global_o
return;
}
- global_object.put(name, value);
+ global_object.set(name, value, true);
}
bool VM::delete_variable(FlyString const& name)
@@ -298,7 +298,7 @@ void VM::assign(const NonnullRefPtr<BindingPattern>& target, Value value, Global
continue;
if (seen_names.contains(object_property.key.to_display_string()))
continue;
- rest_object->put(object_property.key, object->get(object_property.key));
+ rest_object->set(object_property.key, object->get(object_property.key), true);
if (exception())
return;
}