Skip to content

Commit

Permalink
Add lookup_variable_in_current_scope to SymbolTable
Browse files Browse the repository at this point in the history
  • Loading branch information
d0cd committed Apr 19, 2024
1 parent 19a3620 commit 4ec7fff
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions compiler/passes/src/common/symbol_table/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,11 @@ impl SymbolTable {
}
}

/// Attempts to lookup a variable in the current scope.
pub fn lookup_variable_in_current_scope(&self, location: Location) -> Option<&VariableSymbol> {
self.variables.get(&location)
}

/// Returns the scope associated with `index`, if it exists in the symbol table.
pub fn lookup_scope_by_index(&self, index: usize) -> Option<&RefCell<Self>> {
self.scopes.get(index)
Expand Down

0 comments on commit 4ec7fff

Please sign in to comment.