use crate::{Expression, Identifier, Node, NodeID, Statement, Type};
use leo_span::Span;
use serde::{Deserialize, Serialize};
use std::fmt;
#[derive(Clone, Default, PartialEq, Eq, Serialize, Deserialize, Debug)]
pub struct ConstDeclaration {
pub place: Identifier,
pub type_: Type,
pub value: Expression,
pub span: Span,
pub id: NodeID,
}
impl fmt::Display for ConstDeclaration {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "const {}: {} = {}", self.place, self.type_, self.value)
}
}
impl From<ConstDeclaration> for Statement {
fn from(value: ConstDeclaration) -> Self {
Statement::Const(value)
}
}
crate::simple_node_impl!(ConstDeclaration);