microcad_lang/syntax/call/
method_call.rs1use crate::{src_ref::*, syntax::*};
7
8#[derive(Clone)]
10pub struct MethodCall {
11 pub name: QualifiedName,
13 pub argument_list: ArgumentList,
15 pub src_ref: SrcRef,
17}
18
19impl SrcReferrer for MethodCall {
20 fn src_ref(&self) -> SrcRef {
21 self.src_ref.clone()
22 }
23}
24
25impl std::fmt::Display for MethodCall {
26 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
27 write!(f, "{}({})", self.name, self.argument_list)
28 }
29}
30
31impl std::fmt::Debug for MethodCall {
32 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
33 write!(f, "{:?}({:?})", self.name, self.argument_list)
34 }
35}
36
37impl TreeDisplay for MethodCall {
38 fn tree_print(&self, f: &mut std::fmt::Formatter, mut depth: TreeState) -> std::fmt::Result {
39 writeln!(f, "{:depth$}MethodCall '{}':", "", self.name)?;
40 depth.indent();
41 self.argument_list.tree_print(f, depth)
42 }
43}