From 1cfa5862b1da6647c248e1130c5aab856cb99573 Mon Sep 17 00:00:00 2001 From: Markus Westerlind Date: Sun, 11 Dec 2016 22:08:37 +0100 Subject: [PATCH] fix(compiler): Correctly close the debug variable information --- vm/src/compiler.rs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/vm/src/compiler.rs b/vm/src/compiler.rs index c38ca7bbda..a669d47620 100644 --- a/vm/src/compiler.rs +++ b/vm/src/compiler.rs @@ -273,9 +273,9 @@ impl FunctionEnv { self.new_stack_var(compiler, s, typ) } - fn new_stack_var(&mut self, _compiler: &Compiler, s: Symbol, typ: ArcType) { + fn new_stack_var(&mut self, compiler: &Compiler, s: Symbol, typ: ArcType) { debug!("Push var: {:?} at {}", s, self.stack_size - 1); - if self.emit_debug_info { + if self.emit_debug_info && compiler.empty_symbol != s { self.function .debug_info .local_map @@ -289,6 +289,9 @@ impl FunctionEnv { for x in self.stack.exit_scope() { count += 1; debug!("Pop var: {:?}", x); + if self.emit_debug_info && compiler.empty_symbol != x.0 { + self.function.debug_info.local_map.close(self.function.instructions.len()); + } } count } @@ -895,7 +898,7 @@ impl<'a> Compiler<'a> { Some(&(ref name, ref bind)) => { (bind.as_ref().unwrap_or(name).clone(), field.typ.clone()) } - None => (self.symbols.symbol(""), Type::hole()), + None => (self.empty_symbol.clone(), Type::hole()), }; function.push_stack_var(self, name, typ); }