Skip to content

Commit

Permalink
add debug annoatations
Browse files Browse the repository at this point in the history
  • Loading branch information
jasonwilliams committed Oct 6, 2024
1 parent aaa4bf3 commit d697af1
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
3 changes: 2 additions & 1 deletion core/engine/src/object/builtins/lazy_builtin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ pub(crate) enum BuiltinKind {

/// A builtin function. Used for lazy initialization of builtins.
#[derive(Clone, Finalize)]
#[derive(Clone, Finalize, Debug)]
#[allow(clippy::type_complexity)]
pub struct LazyBuiltIn {
pub(crate) init_and_realm: Option<(fn(&Realm), WeakGc<RealmInner>)>,
pub(crate) kind: BuiltinKind,
Expand Down
15 changes: 14 additions & 1 deletion core/engine/src/realm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -70,10 +70,23 @@ pub struct RealmInner {
template_map: GcRefCell<FxHashMap<u64, JsObject>>,
loaded_modules: GcRefCell<FxHashMap<JsString, Module>>,
host_classes: GcRefCell<FxHashMap<TypeId, StandardConstructor>>,

host_defined: GcRefCell<HostDefined>,
}

#[allow(clippy::missing_fields_in_debug)]
impl std::fmt::Debug for RealmInner {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
f.debug_struct("RealmInner")
.field("intrinsics", &self.intrinsics)
.field("environment", &self.environment)
.field("global_object", &self.global_object)
.field("global_this", &self.global_this)
.field("template_map", &self.template_map)
.field("loaded_modules", &self.loaded_modules)
.field("host_classes", &self.host_classes)
.finish()
}
}
impl Realm {
/// Create a new [`Realm`].
#[inline]
Expand Down

0 comments on commit d697af1

Please sign in to comment.