mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 19:18:12 +00:00
LibJS: Replace boolean without_side_effects parameters with an enum
This commit is contained in:
parent
864beb0bd5
commit
dcb55db99b
16 changed files with 56 additions and 51 deletions
|
@ -207,10 +207,10 @@ bool IndexedPropertyIterator::operator!=(const IndexedPropertyIterator& other) c
|
|||
return m_index != other.m_index;
|
||||
}
|
||||
|
||||
ValueAndAttributes IndexedPropertyIterator::value_and_attributes(Object* this_object, bool evaluate_accessors)
|
||||
ValueAndAttributes IndexedPropertyIterator::value_and_attributes(Object* this_object, AllowSideEffects allow_side_effects)
|
||||
{
|
||||
if (m_index < m_indexed_properties.array_like_size())
|
||||
return m_indexed_properties.get(this_object, m_index, evaluate_accessors).value_or({});
|
||||
return m_indexed_properties.get(this_object, m_index, allow_side_effects).value_or({});
|
||||
return {};
|
||||
}
|
||||
|
||||
|
@ -226,10 +226,10 @@ void IndexedPropertyIterator::skip_empty_indices()
|
|||
m_index = m_indexed_properties.array_like_size();
|
||||
}
|
||||
|
||||
Optional<ValueAndAttributes> IndexedProperties::get(Object* this_object, u32 index, bool evaluate_accessors) const
|
||||
Optional<ValueAndAttributes> IndexedProperties::get(Object* this_object, u32 index, AllowSideEffects allow_side_effects) const
|
||||
{
|
||||
auto result = m_storage->get(index);
|
||||
if (!evaluate_accessors)
|
||||
if (allow_side_effects == AllowSideEffects::No)
|
||||
return result;
|
||||
if (!result.has_value())
|
||||
return {};
|
||||
|
@ -242,13 +242,13 @@ Optional<ValueAndAttributes> IndexedProperties::get(Object* this_object, u32 ind
|
|||
return result;
|
||||
}
|
||||
|
||||
void IndexedProperties::put(Object* this_object, u32 index, Value value, PropertyAttributes attributes, bool evaluate_accessors)
|
||||
void IndexedProperties::put(Object* this_object, u32 index, Value value, PropertyAttributes attributes, AllowSideEffects allow_side_effects)
|
||||
{
|
||||
if (m_storage->is_simple_storage() && (attributes != default_attributes || index > (array_like_size() + SPARSE_ARRAY_HOLE_THRESHOLD))) {
|
||||
switch_to_generic_storage();
|
||||
}
|
||||
|
||||
if (m_storage->is_simple_storage() || !evaluate_accessors) {
|
||||
if (m_storage->is_simple_storage() || allow_side_effects == AllowSideEffects::No) {
|
||||
m_storage->put(index, value, attributes);
|
||||
return;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue