microcad_lang/syntax/call/
mod.rs1mod argument;
7mod argument_list;
8mod method_call;
9
10pub use argument::*;
11pub use argument_list::*;
12pub use method_call::*;
13
14use crate::{model::*, src_ref::*, syntax::*, value::*};
15
16#[derive(Clone, Debug, Default)]
18pub struct Call {
19 pub name: QualifiedName,
21 pub argument_list: ArgumentList,
23 pub src_ref: SrcRef,
25}
26
27impl SrcReferrer for Call {
28 fn src_ref(&self) -> SrcRef {
29 self.src_ref.clone()
30 }
31}
32
33impl std::fmt::Display for Call {
34 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
35 write!(f, "{}({})", self.name, self.argument_list)
36 }
37}
38
39impl TreeDisplay for Call {
40 fn tree_print(&self, f: &mut std::fmt::Formatter, mut depth: TreeState) -> std::fmt::Result {
41 writeln!(f, "{:depth$}Call '{}':", "", self.name)?;
42 depth.indent();
43 self.argument_list
44 .iter()
45 .try_for_each(|a| a.tree_print(f, depth))
46 }
47}
48
49pub enum CallResult {
51 Models(Vec<Model>),
53
54 Value(Value),
56
57 None,
59}