1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
use sway_types::{Named, Spanned};

use crate::{language::parsed::Expression, Ident, TypeArgument};

#[derive(Debug, Clone)]
pub struct VariableDeclaration {
    pub name: Ident,
    pub type_ascription: TypeArgument,
    pub body: Expression, // will be codeblock variant
    pub is_mutable: bool,
}

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

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