deimos-lang/dmc-lib/src/ast/path.rs

44 lines
885 B
Rust

use crate::ast::NodeId;
use crate::ast::expression::Expression;
use crate::ast::identifier::Identifier;
use crate::source_range::SourceRange;
pub struct Path {
node_id: NodeId,
source_range: SourceRange,
base: Box<Expression>,
identifier: Box<Identifier>,
}
impl Path {
pub fn new(
node_id: NodeId,
source_range: SourceRange,
base: Expression,
identifier: Identifier,
) -> Self {
Self {
node_id,
source_range,
base: base.into(),
identifier: identifier.into(),
}
}
pub fn node_id(&self) -> NodeId {
self.node_id
}
pub fn source_range(&self) -> &SourceRange {
&self.source_range
}
pub fn base(&self) -> &Expression {
&self.base
}
pub fn identifier(&self) -> &Identifier {
&self.identifier
}
}