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
use crate::{
    engine_threading::DebugWithEngines,
    language::{parsed::Expression, Visibility},
    transform, Engines, TypeArgument,
};
use sway_types::{Ident, Named, Span, Spanned};

#[derive(Debug, Clone)]
pub struct ConfigurableDeclaration {
    pub name: Ident,
    pub attributes: transform::AttributesMap,
    pub type_ascription: TypeArgument,
    pub value: Option<Expression>,
    pub visibility: Visibility,
    pub span: Span,
    pub block_keyword_span: Span,
}

impl Named for ConfigurableDeclaration {
    fn name(&self) -> &sway_types::BaseIdent {
        &self.name
    }
}

impl Spanned for ConfigurableDeclaration {
    fn span(&self) -> sway_types::Span {
        self.span.clone()
    }
}

impl DebugWithEngines for ConfigurableDeclaration {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>, _engines: &Engines) -> std::fmt::Result {
        f.write_fmt(format_args!("{}", self.name))
    }
}