diff --git a/src/resolver.rs b/src/resolver.rs index e91d193..bc48b69 100644 --- a/src/resolver.rs +++ b/src/resolver.rs @@ -2,10 +2,12 @@ use std::collections::HashMap; use crate::{ast, errors::ParserError, tokens::Token}; -pub fn resolve_variables(program: &ast::ProgramNode) -> ResolverResult { +pub type ResolvedVariables = HashMap<*const ast::ExprNode, usize>; + +pub fn resolve_variables(program: &ast::ProgramNode) -> Result { let mut state = ResolverState::default(); program.resolve(&mut state)?; - Ok(()) + Ok(state.resolved) } type ResolverResult = Result<(), ParserError>; @@ -13,7 +15,7 @@ type ResolverResult = Result<(), ParserError>; #[derive(Default)] struct ResolverState { scopes: Vec>, - resolved: HashMap<*const ast::ExprNode, usize>, + resolved: ResolvedVariables, } impl ResolverState {