From c9371546010ec328806e773d96b92fb7a60f518e Mon Sep 17 00:00:00 2001 From: Jean-Marie Mineau Date: Mon, 18 Dec 2023 10:09:47 +0100 Subject: [PATCH] implem __str__ and __repr__ for call site --- androscalpel/src/instructions.rs | 28 ++++++++++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) diff --git a/androscalpel/src/instructions.rs b/androscalpel/src/instructions.rs index 810226f..91298ba 100644 --- a/androscalpel/src/instructions.rs +++ b/androscalpel/src/instructions.rs @@ -1238,11 +1238,35 @@ impl CallSite { } pub fn __str__(&self) -> String { - todo!() + let args = self + .args + .iter() + .map(|arg| arg.__str__()) + .collect::>() + .join(", "); + format!( + "call({} {} {} ({})", + self.method_handle.__str__(), + self.type_.__str__(), + self.name.__str__(), + args + ) } pub fn __repr__(&self) -> String { - todo!() + let args = self + .args + .iter() + .map(|arg| arg.__str__()) + .collect::>() + .join(", "); + format!( + "CallSite({}, {}, {}, [{}]", + self.method_handle.__repr__(), + self.type_.__repr__(), + self.name.__repr__(), + args + ) } }