From 2f467702e32704cc9759e1a59c1f012db815e676 Mon Sep 17 00:00:00 2001 From: greg Date: Mon, 21 Oct 2019 04:19:26 -0700 Subject: [PATCH] Use common scope resolver So that if you import something at the repl, it stays imported --- schala-lang/language/src/schala.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/schala-lang/language/src/schala.rs b/schala-lang/language/src/schala.rs index 16ee7bc..4eaefdf 100644 --- a/schala-lang/language/src/schala.rs +++ b/schala-lang/language/src/schala.rs @@ -21,6 +21,7 @@ pub struct Schala { source_reference: SourceReference, state: eval::State<'static>, symbol_table: Rc>, + resolver: crate::scope_resolution::ScopeResolver<'static>, type_context: typechecking::TypeContext<'static>, active_parser: Option, } @@ -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 { - 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) }