From 79b7da92f3fa24a6922ec7f29261382d013b6c54 Mon Sep 17 00:00:00 2001 From: Michael Benfield Date: Wed, 11 Dec 2024 10:57:36 -0800 Subject: [PATCH] program fix for calls --- interpreter/src/cursor.rs | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/interpreter/src/cursor.rs b/interpreter/src/cursor.rs index 793b8fe804..6efed90906 100644 --- a/interpreter/src/cursor.rs +++ b/interpreter/src/cursor.rs @@ -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!(),