From 4c99be700f158ed9a76b4c8365e44539b5e4e82e Mon Sep 17 00:00:00 2001 From: Greg Shuflin Date: Thu, 16 Dec 2021 10:49:46 -0800 Subject: [PATCH] Fix failing test --- schala-lang/src/symbol_table/populator.rs | 7 ++++++- schala-lang/src/symbol_table/resolver.rs | 2 -- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/schala-lang/src/symbol_table/populator.rs b/schala-lang/src/symbol_table/populator.rs index 41b61e8..562bdf4 100644 --- a/schala-lang/src/symbol_table/populator.rs +++ b/schala-lang/src/symbol_table/populator.rs @@ -85,12 +85,17 @@ impl<'a> SymbolTablePopulator<'a> { let Statement { id, kind, location } = decl_stmt; let location = *location; match kind { - decl @ Declaration::FuncDecl(..) => { + decl @ Declaration::FuncDecl(signature, body) => { let output = self.add_single_declaration(id, decl, location, scope_stack, true); if let Err(e) = output { errors.push(e); }; + let new_scope = ScopeSegment::Name(signature.name.clone()); + scope_stack.push(new_scope); + let output = self.add_from_scope(body.as_ref(), scope_stack, true); + scope_stack.pop(); + errors.extend(output.into_iter()); } _other => errors.push(SymbolError::BadImplBlockEntry), }; diff --git a/schala-lang/src/symbol_table/resolver.rs b/schala-lang/src/symbol_table/resolver.rs index d92b406..5529bd9 100644 --- a/schala-lang/src/symbol_table/resolver.rs +++ b/schala-lang/src/symbol_table/resolver.rs @@ -28,8 +28,6 @@ enum ScopeType { pub struct ScopeResolver<'a> { symbol_table: &'a mut super::SymbolTable, - //TODO maybe this shouldn't be a scope stack, b/c the recursion behavior comes from multiple - //instances of ScopeResolver lexical_scopes: LexScope<'a>, }