diff --git a/crates/lean_compiler/src/b_compile_intermediate.rs b/crates/lean_compiler/src/b_compile_intermediate.rs index 92818757..cffa8f45 100644 --- a/crates/lean_compiler/src/b_compile_intermediate.rs +++ b/crates/lean_compiler/src/b_compile_intermediate.rs @@ -10,7 +10,7 @@ use utils::ToUsize; #[derive(Default)] struct Compiler { bytecode: BTreeMap>, - match_blocks: Vec>>, // each match = many bytecode blocks, each bytecode block = many instructions + match_blocks: Vec, if_counter: usize, call_counter: usize, func_name: String, @@ -152,10 +152,17 @@ fn compile_function( compiler.args_count = function.arguments.len(); let mut declared_vars: BTreeSet = function.arguments.iter().cloned().collect(); - compile_lines(&function.instructions, compiler, None, &mut declared_vars) + compile_lines( + &Label::function(function.name.clone()), + &function.instructions, + compiler, + None, + &mut declared_vars, + ) } fn compile_lines( + function_name: &Label, lines: &[SimpleLine], compiler: &mut Compiler, final_jump: Option