|
|
|
@ -159,11 +159,12 @@ impl ValueData {
|
|
|
|
|
/// Resolve the property in the object
|
|
|
|
|
/// Returns a copy of the 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
|
|
|
|
|
// TODO: Maybe we need a GetLengthProperty for value types
|
|
|
|
|
if let ValueData::String(ref s) = *self { |
|
|
|
|
return Some(Property::new(to_value(s.len() as f64))) |
|
|
|
|
// TODO: Move this to a better place
|
|
|
|
|
if self.is_string() && field == "length" { |
|
|
|
|
if let ValueData::String(ref s) = *self { |
|
|
|
|
return Some(Property::new(to_value(s.len() as f64))) |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
let obj: ObjectData = match *self { |
|
|
|
|