use std::fmt::Display;
use serde::{Deserialize, Serialize};
use leo_ast::{Mode, Type};
use leo_span::Span;
#[derive(Clone, Copy, Debug, Eq, PartialEq, Serialize, Deserialize)]
pub enum VariableType {
Const,
Input(Mode),
Mut,
}
impl Display for VariableType {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
use VariableType::*;
match self {
Const => write!(f, "const var"),
Input(m) => write!(f, "{m} input"),
Mut => write!(f, "mut var"),
}
}
}
#[derive(Clone, Debug, Eq, PartialEq, Serialize, Deserialize)]
pub struct VariableSymbol {
pub type_: Type,
pub span: Span,
pub declaration: VariableType,
}
impl Display for VariableSymbol {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(f, "{}: {}", self.declaration, self.type_)?;
Ok(())
}
}