diff --git a/src/resolver.rs b/src/resolver.rs index 4a35811..e91d193 100644 --- a/src/resolver.rs +++ b/src/resolver.rs @@ -68,8 +68,12 @@ impl ResolverState { self.declare(param); self.define(param); } + // Unlike the original Lox, function arguments and function bodies do + // not use the same environment. + self.begin_scope(); let result = body.resolve(self); self.end_scope(); + self.end_scope(); result }