wright/ast/decl/constant.rs
1//! Constant declarations, such as `const MAX: u8 = 255;`.
2
3use crate::ast::{expr::Expr, identifier::Identifier, ty::Type};
4use crate::source_tracking::fragment::Fragment;
5
6/// A constant declaration in wright source code.
7#[derive(Debug, Clone, PartialEq)]
8pub struct ConstDecl {
9 /// Full matching source of the declaration.
10 pub matching_source: Fragment,
11
12 /// The name of the constant.
13 pub name: Identifier,
14
15 /// The declared type of the constant, if specified.
16 pub ty: Option<Type>,
17
18 /// The value of the constant.
19 pub value: Expr,
20}