|
|
@ -159,11 +159,12 @@ impl ValueData { |
|
|
|
/// Resolve the property in the object
|
|
|
|
/// Resolve the property in the object
|
|
|
|
/// Returns a copy of the Property
|
|
|
|
/// Returns a copy of the Property
|
|
|
|
pub fn get_prop(&self, field: String) -> Option<Property> { |
|
|
|
pub fn get_prop(&self, field: String) -> Option<Property> { |
|
|
|
// handle length
|
|
|
|
|
|
|
|
// Spidermonkey has its own GetLengthProperty: https://searchfox.org/mozilla-central/source/js/src/vm/Interpreter-inl.h#154
|
|
|
|
// Spidermonkey has its own GetLengthProperty: https://searchfox.org/mozilla-central/source/js/src/vm/Interpreter-inl.h#154
|
|
|
|
// TODO: Maybe we need a GetLengthProperty for value types
|
|
|
|
// TODO: Move this to a better place
|
|
|
|
if let ValueData::String(ref s) = *self { |
|
|
|
if self.is_string() && field == "length" { |
|
|
|
return Some(Property::new(to_value(s.len() as f64))) |
|
|
|
if let ValueData::String(ref s) = *self { |
|
|
|
|
|
|
|
return Some(Property::new(to_value(s.len() as f64))) |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
let obj: ObjectData = match *self { |
|
|
|
let obj: ObjectData = match *self { |
|
|
|