diff --git a/src/resolver.rs b/src/resolver.rs
index fa47279..ecc6d83 100644
--- a/src/resolver.rs
+++ b/src/resolver.rs
@@ -262,7 +262,7 @@ where
     }
     // Unlike the original Lox, function arguments and function bodies do
     // not use the same environment.
-    rs.with_scope(|rs| body.resolve(rs), ScopeType::Function)
+    rs.with_scope(|rs| body.resolve(rs), rs.current_type())
 }
 
 /// Process all method definitions in a class.