mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 14:38:11 +00:00
LibJS: Distinguish between omitted descriptor attributes and false ones
When calling Object.defineProperty, there is now a difference between omitting a descriptor attribute and specifying that it is false. For example, "{}" and "{ configurable: false }" will have different attribute values.
This commit is contained in:
parent
5c485d4a1e
commit
5ad5322f6a
8 changed files with 186 additions and 83 deletions
|
@ -29,6 +29,11 @@
|
|||
|
||||
namespace JS {
|
||||
|
||||
const LogStream& operator<<(const LogStream& stream, const PropertyAttributes& attributes)
|
||||
{
|
||||
return stream << attributes.bits();
|
||||
}
|
||||
|
||||
Shape* Shape::create_unique_clone() const
|
||||
{
|
||||
auto* new_shape = heap().allocate<Shape>();
|
||||
|
@ -40,7 +45,7 @@ Shape* Shape::create_unique_clone() const
|
|||
return new_shape;
|
||||
}
|
||||
|
||||
Shape* Shape::create_put_transition(const FlyString& property_name, u8 attributes)
|
||||
Shape* Shape::create_put_transition(const FlyString& property_name, PropertyAttributes attributes)
|
||||
{
|
||||
TransitionKey key { property_name, attributes };
|
||||
if (auto* existing_shape = m_forward_transitions.get(key).value_or(nullptr))
|
||||
|
@ -50,7 +55,7 @@ Shape* Shape::create_put_transition(const FlyString& property_name, u8 attribute
|
|||
return new_shape;
|
||||
}
|
||||
|
||||
Shape* Shape::create_configure_transition(const FlyString& property_name, u8 attributes)
|
||||
Shape* Shape::create_configure_transition(const FlyString& property_name, PropertyAttributes attributes)
|
||||
{
|
||||
TransitionKey key { property_name, attributes };
|
||||
if (auto* existing_shape = m_forward_transitions.get(key).value_or(nullptr))
|
||||
|
@ -69,7 +74,7 @@ Shape::Shape()
|
|||
{
|
||||
}
|
||||
|
||||
Shape::Shape(Shape* previous_shape, const FlyString& property_name, u8 attributes, TransitionType transition_type)
|
||||
Shape::Shape(Shape* previous_shape, const FlyString& property_name, PropertyAttributes attributes, TransitionType transition_type)
|
||||
: m_previous(previous_shape)
|
||||
, m_property_name(property_name)
|
||||
, m_attributes(attributes)
|
||||
|
@ -160,7 +165,7 @@ void Shape::ensure_property_table() const
|
|||
}
|
||||
}
|
||||
|
||||
void Shape::add_property_to_unique_shape(const FlyString& property_name, u8 attributes)
|
||||
void Shape::add_property_to_unique_shape(const FlyString& property_name, PropertyAttributes attributes)
|
||||
{
|
||||
ASSERT(is_unique());
|
||||
ASSERT(m_property_table);
|
||||
|
@ -168,7 +173,7 @@ void Shape::add_property_to_unique_shape(const FlyString& property_name, u8 attr
|
|||
m_property_table->set(property_name, { m_property_table->size(), attributes });
|
||||
}
|
||||
|
||||
void Shape::reconfigure_property_in_unique_shape(const FlyString& property_name, u8 attributes)
|
||||
void Shape::reconfigure_property_in_unique_shape(const FlyString& property_name, PropertyAttributes attributes)
|
||||
{
|
||||
ASSERT(is_unique());
|
||||
ASSERT(m_property_table);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue