implem __str__ and __repr__ for call site

This commit is contained in:
Jean-Marie Mineau 2023-12-18 10:09:47 +01:00
parent 0c928e4fd2
commit c937154601
Signed by: histausse
GPG key ID: B66AEEDA9B645AD2

View file

@ -1238,11 +1238,35 @@ impl CallSite {
} }
pub fn __str__(&self) -> String { pub fn __str__(&self) -> String {
todo!() let args = self
.args
.iter()
.map(|arg| arg.__str__())
.collect::<Vec<_>>()
.join(", ");
format!(
"call({} {} {} ({})",
self.method_handle.__str__(),
self.type_.__str__(),
self.name.__str__(),
args
)
} }
pub fn __repr__(&self) -> String { pub fn __repr__(&self) -> String {
todo!() let args = self
.args
.iter()
.map(|arg| arg.__str__())
.collect::<Vec<_>>()
.join(", ");
format!(
"CallSite({}, {}, {}, [{}]",
self.method_handle.__repr__(),
self.type_.__repr__(),
self.name.__repr__(),
args
)
} }
} }