Skip to content

Commit

Permalink
Update array_checker.rs
Browse files Browse the repository at this point in the history
  • Loading branch information
wtholliday committed Sep 24, 2023
1 parent 3180271 commit 65dcb15
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/array_checker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,19 @@ impl ArrayChecker {

fn check_expr(&mut self, expr: ExprID, decl: &FuncDecl, decls: &DeclTable) -> IndexInterval {
match &decl.arena[expr] {
Expr::Int(x) => {
IndexInterval { min: *x, max: *x }
}
Expr::Block(exprs) => {
let n = self.vars.len();
for e in exprs {
self.check_expr(*e, decl, decls);
}
while self.vars.len() > n {
self.vars.pop();
}
IndexInterval::default()
}
Expr::Let(name, init, _) => {
self.check_expr(*init, decl, decls);
let ty = decl.types[expr];
Expand Down

0 comments on commit 65dcb15

Please sign in to comment.