microcad_lang/syntax/call/
method_call.rs1use crate::{src_ref::*, syntax::*};
7
8#[derive(Clone, Debug)]
10pub struct MethodCall {
11 pub id: 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.id, self.argument_list)
28 }
29}
30
31impl TreeDisplay for MethodCall {
32 fn tree_print(&self, f: &mut std::fmt::Formatter, mut depth: TreeState) -> std::fmt::Result {
33 writeln!(f, "{:depth$}MethodCall '{}':", "", self.id)?;
34 depth.indent();
35 self.argument_list.tree_print(f, depth)
36 }
37}