Skip to content

Commit

Permalink
Fixed Function object specialization
Browse files Browse the repository at this point in the history
  • Loading branch information
HalidOdat committed May 27, 2020
1 parent 1b76706 commit 16ce549
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
10 changes: 10 additions & 0 deletions boa/src/builtins/object/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -462,6 +462,16 @@ pub enum ObjectData {
Ordinary,
}

impl ObjectData {
#[inline]
pub fn is_array(&self) -> bool {
match self {
Self::Array => true,
_ => false,
}
}
}

impl Display for ObjectData {
fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error> {
write!(
Expand Down
2 changes: 1 addition & 1 deletion boa/src/builtins/value/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -614,7 +614,7 @@ impl ValueData {
let val = val.into();

if let Self::Object(ref obj) = *self {
if let ObjectData::Array = obj.borrow().data {
if obj.borrow().data.is_array() {
if let Ok(num) = field.to_string().parse::<usize>() {
if num > 0 {
let len = i32::from(&self.get_field("length"));
Expand Down

0 comments on commit 16ce549

Please sign in to comment.