Skip to content

Commit

Permalink
Merge 9d3d578 into 2239669
Browse files Browse the repository at this point in the history
  • Loading branch information
HalidOdat authored Apr 8, 2022
2 parents 2239669 + 9d3d578 commit 5eeac73
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
2 changes: 1 addition & 1 deletion boa_engine/src/builtins/array_buffer/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ impl ArrayBuffer {
Ok(args
.get_or_undefined(0)
.as_object()
.map(|obj| obj.borrow().is_typed_array())
.map(|obj| obj.borrow().has_viewed_array_buffer())
.unwrap_or_default()
.into())
}
Expand Down
17 changes: 17 additions & 0 deletions boa_engine/src/object/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -519,6 +519,23 @@ impl Object {
}
}

#[inline]
pub(crate) fn has_viewed_array_buffer(&self) -> bool {
self.is_typed_array() || self.is_data_view()
}

/// Checks if it an `DataView` object.
#[inline]
pub fn is_data_view(&self) -> bool {
matches!(
self.data,
ObjectData {
kind: ObjectKind::DataView(_),
..
}
)
}

/// Checks if it an `ArrayBuffer` object.
#[inline]
pub fn is_array_buffer(&self) -> bool {
Expand Down

0 comments on commit 5eeac73

Please sign in to comment.