Manually implement Debug for MethodInst

MethodInst's self_binding was causing endless recursion issues, this
just skips over it and uses the normal formatting for it

Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
This commit is contained in:
2024-09-24 12:30:26 -07:00
parent 3e769e9c48
commit 56001856be

View File

@@ -223,13 +223,23 @@ impl Obj for UserFunctionInst {
// MethodInst // MethodInst
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
#[derive(Debug, Trace)] #[derive(Trace)]
pub struct MethodInst { pub struct MethodInst {
base: BaseObjInst, base: BaseObjInst,
self_binding: ObjP, self_binding: ObjP,
function: ObjP, function: ObjP,
} }
impl Debug for MethodInst {
fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
fmt.debug_struct("MethodInst")
.field("base", &self.base)
.field("self_binding", &format!("{}", self.self_binding.borrow()))
.field("function", &self.function)
.finish()
}
}
impl MethodInst { impl MethodInst {
pub fn new(self_binding: ObjP, function: ObjP) -> Self { pub fn new(self_binding: ObjP, function: ObjP) -> Self {
Self { Self {