diff --git a/schala-lang/language/src/schala.rs b/schala-lang/language/src/schala.rs index c400a69..a16d6b8 100644 --- a/schala-lang/language/src/schala.rs +++ b/schala-lang/language/src/schala.rs @@ -144,8 +144,9 @@ fn symbol_table(input: ast::AST, handle: &mut Schala, comp: Option<&mut PassDebu Ok(input) } -fn scope_resolution(mut input: ast::AST, _handle: &mut Schala, _com: Option<&mut PassDebugArtifact>) -> Result { - let mut resolver = crate::scope_resolution::ScopeResolver::new(); +fn scope_resolution(mut input: ast::AST, handle: &mut Schala, _com: Option<&mut PassDebugArtifact>) -> Result { + let symbol_table = handle.symbol_table.borrow(); + let mut resolver = crate::scope_resolution::ScopeResolver::new(&symbol_table); let () = resolver.resolve(&mut input)?; Ok(input) } diff --git a/schala-lang/language/src/scope_resolution.rs b/schala-lang/language/src/scope_resolution.rs index 38f1f12..8ec6abf 100644 --- a/schala-lang/language/src/scope_resolution.rs +++ b/schala-lang/language/src/scope_resolution.rs @@ -1,12 +1,13 @@ -use crate::symbol_table::{ScopeSegment, ScopeSegmentKind, FullyQualifiedSymbolName}; +use crate::symbol_table::{SymbolTable, ScopeSegment, ScopeSegmentKind, FullyQualifiedSymbolName}; use crate::ast::*; -pub struct ScopeResolver { +pub struct ScopeResolver<'a> { + symbol_table: &'a SymbolTable } -impl ScopeResolver { - pub fn new() -> ScopeResolver { - ScopeResolver { } +impl<'a> ScopeResolver<'a> { + pub fn new(symbol_table: &'a SymbolTable) -> ScopeResolver { + ScopeResolver { symbol_table } } pub fn resolve(&mut self, ast: &mut AST) -> Result<(), String> { for statement in ast.0.iter_mut() {