1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
use crate::ast::identifier::Identifier;
use crate::ast::type_expr::TypeExpr;
use crate::{declare_container_node, impl_container_node_defaults, node_child_fn};
use crate::format::Writer;
use crate::traits::node_trait::NodeTrait;
use crate::traits::write::Write;

declare_container_node!(ArgumentDeclaration,
    pub(crate) name: usize,
    pub(crate) name_optional: bool,
    pub(crate) type_expr: usize
);

impl_container_node_defaults!(ArgumentDeclaration);

impl ArgumentDeclaration {

    node_child_fn!(name, Identifier);

    node_child_fn!(type_expr, TypeExpr);
}

impl Write for ArgumentDeclaration {
    fn write<'a>(&'a self, writer: &mut Writer<'a>) {
        writer.write_children(self, self.children.values());
    }
}