1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 03:17:35 +00:00

LibJS: Remove the NativeProperty mechanism from LibJS

These were an ad-hoc way to implement special behaviour when reading or
writing to specific object properties. Because these were effectively
replaced by the abillity to override the internal methods of Object,
they are no longer needed.
This commit is contained in:
Idan Horowitz 2021-07-07 19:34:26 +03:00 committed by Linus Groh
parent 306d59276a
commit 795786387b
11 changed files with 9 additions and 157 deletions

View file

@ -41,7 +41,6 @@ public:
Symbol,
Accessor,
BigInt,
NativeProperty,
};
enum class PreferredType {
@ -60,9 +59,8 @@ public:
bool is_symbol() const { return m_type == Type::Symbol; }
bool is_accessor() const { return m_type == Type::Accessor; };
bool is_bigint() const { return m_type == Type::BigInt; };
bool is_native_property() const { return m_type == Type::NativeProperty; }
bool is_nullish() const { return is_null() || is_undefined(); }
bool is_cell() const { return is_string() || is_accessor() || is_object() || is_bigint() || is_symbol() || is_native_property(); }
bool is_cell() const { return is_string() || is_accessor() || is_object() || is_bigint() || is_symbol(); }
bool is_array(GlobalObject&) const;
bool is_function() const;
bool is_constructor() const;
@ -164,12 +162,6 @@ public:
m_value.as_bigint = const_cast<BigInt*>(bigint);
}
Value(const NativeProperty* native_property)
: m_type(Type::NativeProperty)
{
m_value.as_native_property = const_cast<NativeProperty*>(native_property);
}
explicit Value(Type type)
: m_type(type)
{
@ -245,12 +237,6 @@ public:
return *m_value.as_bigint;
}
NativeProperty& as_native_property()
{
VERIFY(is_native_property());
return *m_value.as_native_property;
}
Array& as_array();
FunctionObject& as_function();
@ -318,7 +304,6 @@ private:
Cell* as_cell;
Accessor* as_accessor;
BigInt* as_bigint;
NativeProperty* as_native_property;
u64 encoded;
} m_value { .encoded = 0 };