Skip to content

Commit

Permalink
Add missing public interfaces to ASG (#31)
Browse files Browse the repository at this point in the history
  • Loading branch information
jakelishman authored Jan 16, 2024
1 parent b38f6f2 commit 88211a6
Showing 1 changed file with 18 additions and 3 deletions.
21 changes: 18 additions & 3 deletions crates/oq3_semantics/src/asg.rs
Original file line number Diff line number Diff line change
Expand Up @@ -294,18 +294,29 @@ impl IndexExpression {

#[derive(Clone, Debug, PartialEq, Eq, Hash)]
pub struct IndexedIdentifier {
identifer: SymbolIdResult,
identifier: SymbolIdResult,
indexes: Vec<IndexOperator>,
}

impl IndexedIdentifier {
pub fn new(identifer: SymbolIdResult, indexes: Vec<IndexOperator>) -> IndexedIdentifier {
IndexedIdentifier { identifer, indexes }
pub fn new(identifier: SymbolIdResult, indexes: Vec<IndexOperator>) -> IndexedIdentifier {
IndexedIdentifier {
identifier,
indexes,
}
}

pub fn to_texpr(self) -> TExpr {
TExpr::new(Expr::IndexedIdentifier(self), Type::ToDo)
}

pub fn identifier(&self) -> &SymbolIdResult {
&self.identifier
}

pub fn indexes(&self) -> &[IndexOperator] {
&self.indexes
}
}

#[derive(Clone, Debug, PartialEq, Eq, Hash)]
Expand Down Expand Up @@ -392,6 +403,10 @@ impl SetExpression {
pub fn new(expressions: Vec<TExpr>) -> SetExpression {
SetExpression { expressions }
}

pub fn expressions(&self) -> &[TExpr] {
&self.expressions
}
}

#[derive(Clone, Debug, PartialEq, Eq, Hash)]
Expand Down

0 comments on commit 88211a6

Please sign in to comment.