Skip to content

Commit d697af1

Browse files
committed
add debug annoatations
1 parent aaa4bf3 commit d697af1

File tree

2 files changed

+16
-2
lines changed

2 files changed

+16
-2
lines changed

core/engine/src/object/builtins/lazy_builtin.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,8 @@ pub(crate) enum BuiltinKind {
2525

2626
/// A builtin function. Used for lazy initialization of builtins.
2727
28-
#[derive(Clone, Finalize)]
28+
#[derive(Clone, Finalize, Debug)]
29+
#[allow(clippy::type_complexity)]
2930
pub struct LazyBuiltIn {
3031
pub(crate) init_and_realm: Option<(fn(&Realm), WeakGc<RealmInner>)>,
3132
pub(crate) kind: BuiltinKind,

core/engine/src/realm.rs

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,10 +70,23 @@ pub struct RealmInner {
7070
template_map: GcRefCell<FxHashMap<u64, JsObject>>,
7171
loaded_modules: GcRefCell<FxHashMap<JsString, Module>>,
7272
host_classes: GcRefCell<FxHashMap<TypeId, StandardConstructor>>,
73-
7473
host_defined: GcRefCell<HostDefined>,
7574
}
7675

76+
#[allow(clippy::missing_fields_in_debug)]
77+
impl std::fmt::Debug for RealmInner {
78+
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
79+
f.debug_struct("RealmInner")
80+
.field("intrinsics", &self.intrinsics)
81+
.field("environment", &self.environment)
82+
.field("global_object", &self.global_object)
83+
.field("global_this", &self.global_this)
84+
.field("template_map", &self.template_map)
85+
.field("loaded_modules", &self.loaded_modules)
86+
.field("host_classes", &self.host_classes)
87+
.finish()
88+
}
89+
}
7790
impl Realm {
7891
/// Create a new [`Realm`].
7992
#[inline]

0 commit comments

Comments
 (0)