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
28
29
30
31
32
33
34
35
36
37
38
39
40
use std::cell::RefCell;
use crate::{declare_container_node, impl_container_node_defaults, node_child_fn, node_optional_child_fn};
use crate::ast::doc_comment::DocComment;
use crate::ast::identifier_path::IdentifierPath;
use crate::format::Writer;
use crate::traits::resolved::Resolve;
use crate::traits::write::Write;

declare_container_node!(SynthesizedShapeFieldDeclaration, availability,
    pub(crate) comment: Option<usize>,
    pub(crate) decorator_identifier_path: usize,
    pub(crate) optional: bool,
    pub(crate) resolved: RefCell<Option<SynthesizedShapeFieldDeclarationResolved>>,
);

impl_container_node_defaults!(SynthesizedShapeFieldDeclaration, availability);

impl SynthesizedShapeFieldDeclaration {

    node_optional_child_fn!(comment, DocComment);

    node_child_fn!(decorator_identifier_path, IdentifierPath);
}

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

impl Resolve<SynthesizedShapeFieldDeclarationResolved> for SynthesizedShapeFieldDeclaration {
    fn resolved_ref_cell(&self) -> &RefCell<Option<SynthesizedShapeFieldDeclarationResolved>> {
        &self.resolved
    }
}

#[derive(Debug)]
pub struct SynthesizedShapeFieldDeclarationResolved {
    pub decorator_full_path: Option<Vec<String>>,
}