Resolver - Fixed function handling
* Since the arguments are stored in an intermediate environment, an additional scope is required
This commit is contained in:
parent
5a12ce44c1
commit
376f28044c
1 changed files with 4 additions and 0 deletions
|
@ -68,8 +68,12 @@ impl ResolverState {
|
||||||
self.declare(param);
|
self.declare(param);
|
||||||
self.define(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);
|
let result = body.resolve(self);
|
||||||
self.end_scope();
|
self.end_scope();
|
||||||
|
self.end_scope();
|
||||||
result
|
result
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue