WIP commit - adding ItemId to Expression

This commit is contained in:
greg 2019-09-18 10:09:33 -07:00
parent c12cb99b24
commit 642f21d298

View File

@ -160,17 +160,18 @@ pub enum Variant {
#[derive(Debug, PartialEq, Clone)]
pub struct Expression {
pub id: ItemId,
pub kind: ExpressionKind,
pub type_anno: Option<TypeIdentifier>
}
impl Expression {
pub fn new(kind: ExpressionKind) -> Expression {
Expression { kind, type_anno: None }
pub fn new(id: ItemId, kind: ExpressionKind) -> Expression {
Expression { id, kind, type_anno: None }
}
pub fn with_anno(kind: ExpressionKind, type_anno: TypeIdentifier) -> Expression {
Expression { kind, type_anno: Some(type_anno) }
pub fn with_anno(id: ItemId, kind: ExpressionKind, type_anno: TypeIdentifier) -> Expression {
Expression { id, kind, type_anno: Some(type_anno) }
}
}