Start adding symbol_table to scope resolution
This commit is contained in:
parent
5572e0eebb
commit
418d77770f
@ -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<ast::AST, String> {
|
||||
let mut resolver = crate::scope_resolution::ScopeResolver::new();
|
||||
fn scope_resolution(mut input: ast::AST, handle: &mut Schala, _com: Option<&mut PassDebugArtifact>) -> Result<ast::AST, String> {
|
||||
let symbol_table = handle.symbol_table.borrow();
|
||||
let mut resolver = crate::scope_resolution::ScopeResolver::new(&symbol_table);
|
||||
let () = resolver.resolve(&mut input)?;
|
||||
Ok(input)
|
||||
}
|
||||
|
@ -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() {
|
||||
|
Loading…
Reference in New Issue
Block a user