Resolver - Fixed off-by-one error in resolve_local()
This commit is contained in:
parent
79a0667f34
commit
b5573cee3b
1 changed files with 2 additions and 3 deletions
|
@ -65,14 +65,13 @@ impl ResolverState {
|
|||
}
|
||||
|
||||
fn resolve_local(&mut self, expr: &ast::ExprNode, name: &Token) {
|
||||
let start = self.scopes.len() - 1;
|
||||
let mut i = start;
|
||||
let mut i = self.scopes.len();
|
||||
while i != 0 {
|
||||
i -= 1;
|
||||
if self.scopes[i].contains_key(&name.lexeme as &str) {
|
||||
self.mark_resolved(expr, self.scopes.len() - 1 - i);
|
||||
return;
|
||||
}
|
||||
i -= 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue