From 878bbc8f35178f4350ce0e25dee72dd2ef42ecd8 Mon Sep 17 00:00:00 2001 From: evan-schott <53463459+evan-schott@users.noreply.github.com> Date: Thu, 12 Oct 2023 15:43:21 -0700 Subject: [PATCH] Add stub structs & functions to ST --- compiler/passes/src/symbol_table_creation/creator.rs | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/compiler/passes/src/symbol_table_creation/creator.rs b/compiler/passes/src/symbol_table_creation/creator.rs index 243a4b62e3..fc8d80013a 100644 --- a/compiler/passes/src/symbol_table_creation/creator.rs +++ b/compiler/passes/src/symbol_table_creation/creator.rs @@ -72,4 +72,16 @@ impl<'a> ProgramVisitor<'a> for SymbolTableCreator<'a> { self.handler.emit_err(err); } } + + fn visit_stub(&mut self, input: &'a Stub) { + input.functions.iter().for_each(|(_, c)| (self.visit_function_stub(c))); + + input.structs.iter().for_each(|(_, c)| (self.visit_struct(c))); + } + + fn visit_function_stub(&mut self, input: &'a FunctionStub) { + if let Err(err) = self.symbol_table.insert_fn(input.name(), &Function::from(input.clone())) { + self.handler.emit_err(err); + } + } }