diff --git a/schala-lang/src/lib.rs b/schala-lang/src/lib.rs index e0ad609..f974559 100644 --- a/schala-lang/src/lib.rs +++ b/schala-lang/src/lib.rs @@ -44,8 +44,8 @@ impl Schala { let symbols = Rc::new(RefCell::new(symbol_table::SymbolTable::new())); Schala { symbol_table: symbols.clone(), + type_context: typechecking::TypeContext::new(symbols.clone()), state: eval::State::new(symbols), - type_context: typechecking::TypeContext::new(), } } } diff --git a/schala-lang/src/typechecking.rs b/schala-lang/src/typechecking.rs index ad947e2..839ebbc 100644 --- a/schala-lang/src/typechecking.rs +++ b/schala-lang/src/typechecking.rs @@ -1,3 +1,4 @@ +use std::cell::RefCell; use std::rc::Rc; use std::collections::{HashSet, HashMap}; /* @@ -10,6 +11,7 @@ use itertools::Itertools; use parsing; use util::StateStack; +use symbol_table::{SymbolSpec, Symbol, SymbolTable}; pub type TypeName = Rc; type TypeResult = Result; @@ -54,12 +56,13 @@ impl TypeEnv { pub struct TypeContext<'a> { values: StateStack<'a, TypeName, Type>, + symbol_table_handle: Rc>, global_env: TypeEnv } impl<'a> TypeContext<'a> { - pub fn new() -> TypeContext<'static> { - TypeContext { values: StateStack::new(None), global_env: TypeEnv::default() } + pub fn new(symbol_table_handle: Rc>) -> TypeContext<'static> { + TypeContext { values: StateStack::new(None), global_env: TypeEnv::default(), symbol_table_handle } } pub fn debug_types(&self) -> String {