|
|
@ -52,8 +52,6 @@ pub static PROTOTYPE: &str = "prototype"; |
|
|
|
pub struct Object { |
|
|
|
pub struct Object { |
|
|
|
/// The type of the object.
|
|
|
|
/// The type of the object.
|
|
|
|
pub data: ObjectData, |
|
|
|
pub data: ObjectData, |
|
|
|
/// Internal Slots
|
|
|
|
|
|
|
|
internal_slots: FxHashMap<String, Value>, |
|
|
|
|
|
|
|
/// Properties
|
|
|
|
/// Properties
|
|
|
|
properties: FxHashMap<RcString, Property>, |
|
|
|
properties: FxHashMap<RcString, Property>, |
|
|
|
/// Symbol Properties
|
|
|
|
/// Symbol Properties
|
|
|
@ -110,7 +108,6 @@ impl Default for Object { |
|
|
|
fn default() -> Self { |
|
|
|
fn default() -> Self { |
|
|
|
Self { |
|
|
|
Self { |
|
|
|
data: ObjectData::Ordinary, |
|
|
|
data: ObjectData::Ordinary, |
|
|
|
internal_slots: FxHashMap::default(), |
|
|
|
|
|
|
|
properties: FxHashMap::default(), |
|
|
|
properties: FxHashMap::default(), |
|
|
|
symbol_properties: FxHashMap::default(), |
|
|
|
symbol_properties: FxHashMap::default(), |
|
|
|
prototype: Value::null(), |
|
|
|
prototype: Value::null(), |
|
|
@ -132,7 +129,6 @@ impl Object { |
|
|
|
|
|
|
|
|
|
|
|
Self { |
|
|
|
Self { |
|
|
|
data: ObjectData::Function(function), |
|
|
|
data: ObjectData::Function(function), |
|
|
|
internal_slots: FxHashMap::default(), |
|
|
|
|
|
|
|
properties: FxHashMap::default(), |
|
|
|
properties: FxHashMap::default(), |
|
|
|
symbol_properties: FxHashMap::default(), |
|
|
|
symbol_properties: FxHashMap::default(), |
|
|
|
prototype, |
|
|
|
prototype, |
|
|
@ -158,7 +154,6 @@ impl Object { |
|
|
|
pub fn boolean(value: bool) -> Self { |
|
|
|
pub fn boolean(value: bool) -> Self { |
|
|
|
Self { |
|
|
|
Self { |
|
|
|
data: ObjectData::Boolean(value), |
|
|
|
data: ObjectData::Boolean(value), |
|
|
|
internal_slots: FxHashMap::default(), |
|
|
|
|
|
|
|
properties: FxHashMap::default(), |
|
|
|
properties: FxHashMap::default(), |
|
|
|
symbol_properties: FxHashMap::default(), |
|
|
|
symbol_properties: FxHashMap::default(), |
|
|
|
prototype: Value::null(), |
|
|
|
prototype: Value::null(), |
|
|
@ -171,7 +166,6 @@ impl Object { |
|
|
|
pub fn number(value: f64) -> Self { |
|
|
|
pub fn number(value: f64) -> Self { |
|
|
|
Self { |
|
|
|
Self { |
|
|
|
data: ObjectData::Number(value), |
|
|
|
data: ObjectData::Number(value), |
|
|
|
internal_slots: FxHashMap::default(), |
|
|
|
|
|
|
|
properties: FxHashMap::default(), |
|
|
|
properties: FxHashMap::default(), |
|
|
|
symbol_properties: FxHashMap::default(), |
|
|
|
symbol_properties: FxHashMap::default(), |
|
|
|
prototype: Value::null(), |
|
|
|
prototype: Value::null(), |
|
|
@ -187,7 +181,6 @@ impl Object { |
|
|
|
{ |
|
|
|
{ |
|
|
|
Self { |
|
|
|
Self { |
|
|
|
data: ObjectData::String(value.into()), |
|
|
|
data: ObjectData::String(value.into()), |
|
|
|
internal_slots: FxHashMap::default(), |
|
|
|
|
|
|
|
properties: FxHashMap::default(), |
|
|
|
properties: FxHashMap::default(), |
|
|
|
symbol_properties: FxHashMap::default(), |
|
|
|
symbol_properties: FxHashMap::default(), |
|
|
|
prototype: Value::null(), |
|
|
|
prototype: Value::null(), |
|
|
@ -200,7 +193,6 @@ impl Object { |
|
|
|
pub fn bigint(value: RcBigInt) -> Self { |
|
|
|
pub fn bigint(value: RcBigInt) -> Self { |
|
|
|
Self { |
|
|
|
Self { |
|
|
|
data: ObjectData::BigInt(value), |
|
|
|
data: ObjectData::BigInt(value), |
|
|
|
internal_slots: FxHashMap::default(), |
|
|
|
|
|
|
|
properties: FxHashMap::default(), |
|
|
|
properties: FxHashMap::default(), |
|
|
|
symbol_properties: FxHashMap::default(), |
|
|
|
symbol_properties: FxHashMap::default(), |
|
|
|
prototype: Value::null(), |
|
|
|
prototype: Value::null(), |
|
|
@ -403,16 +395,6 @@ impl Object { |
|
|
|
matches!(self.data, ObjectData::Ordinary) |
|
|
|
matches!(self.data, ObjectData::Ordinary) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
#[inline] |
|
|
|
|
|
|
|
pub fn internal_slots(&self) -> &FxHashMap<String, Value> { |
|
|
|
|
|
|
|
&self.internal_slots |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#[inline] |
|
|
|
|
|
|
|
pub fn internal_slots_mut(&mut self) -> &mut FxHashMap<String, Value> { |
|
|
|
|
|
|
|
&mut self.internal_slots |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#[inline] |
|
|
|
#[inline] |
|
|
|
pub fn properties(&self) -> &FxHashMap<RcString, Property> { |
|
|
|
pub fn properties(&self) -> &FxHashMap<RcString, Property> { |
|
|
|
&self.properties |
|
|
|
&self.properties |
|
|
|