Skip to content

Commit

Permalink
chore: lint the project
Browse files Browse the repository at this point in the history
The vm lint is unimportant but the other one is a bit more important
It could have actually caused a bug if I had not noticed it. An inaccurate
error message would have been printed.
  • Loading branch information
Yag000 committed Aug 29, 2023
1 parent 6a6f58c commit 9472097
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 3 additions & 1 deletion src/interpreter/evaluator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,9 @@ impl Evaluator {
}
Expression::FunctionCall(x) => {
let function = self.eval_expression(*x.function);
if Self::is_error(&function) {}
if Self::is_error(&function) {
return function;
}
let args = self.eval_expressions(x.arguments);
if args.len() == 1 && Self::is_error(&args[0]) {
return args[0].clone();
Expand Down
2 changes: 1 addition & 1 deletion src/vm/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -497,7 +497,7 @@ impl VM {
Object::COMPILEDFUNCTION(func) => {
let mut closure = Closure::new(func);

for obj in self.stack[self.sp - num_free..self.sp].iter() {
for obj in &self.stack[self.sp - num_free..self.sp] {
closure.add_free_variable(obj.as_ref().clone());
}

Expand Down

0 comments on commit 9472097

Please sign in to comment.