Use common scope resolver

So that if you import something at the repl, it stays imported
This commit is contained in:
greg 2019-10-21 04:19:26 -07:00
parent 5ac5425fac
commit 2f467702e3
1 changed files with 3 additions and 2 deletions

View File

@ -21,6 +21,7 @@ pub struct Schala {
source_reference: SourceReference,
state: eval::State<'static>,
symbol_table: Rc<RefCell<symbol_table::SymbolTable>>,
resolver: crate::scope_resolution::ScopeResolver<'static>,
type_context: typechecking::TypeContext<'static>,
active_parser: Option<parsing::Parser>,
}
@ -40,6 +41,7 @@ impl Schala {
Schala {
source_reference: SourceReference::new(),
symbol_table: symbols.clone(),
resolver: crate::scope_resolution::ScopeResolver::new(symbols.clone()),
state: eval::State::new(symbols),
type_context: typechecking::TypeContext::new(),
active_parser: None,
@ -156,8 +158,7 @@ fn symbol_table(input: ast::AST, handle: &mut Schala, comp: Option<&mut PassDebu
}
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(handle.symbol_table.clone());
let () = resolver.resolve(&mut input)?;
let () = handle.resolver.resolve(&mut input)?;
Ok(input)
}