Skip to content

Commit

Permalink
program fix for calls
Browse files Browse the repository at this point in the history
  • Loading branch information
mikebenfield committed Dec 11, 2024
1 parent 6f690f3 commit 79b7da9
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions interpreter/src/cursor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -786,10 +786,12 @@ impl<'a> Cursor<'a> {
let len = self.values.len();
let (program, name) = match &*call.function {
Expression::Identifier(id) => {
let program = call
.program
.unwrap_or_else(|| self.current_program().expect("there should be a current program"));
(program, id.name)
let maybe_program = call.program.or_else(|| self.current_program());
if let Some(program) = maybe_program {
(program, id.name)
} else {
halt!(call.span, "No current program");
}
}
Expression::Locator(locator) => (locator.program.name.name, locator.name),
_ => tc_fail!(),
Expand Down

0 comments on commit 79b7da9

Please sign in to comment.