Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/language/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ impl<'i> Identifier<'i> {
}
}

#[derive(Eq, Debug)]
#[derive(Clone, Copy, Eq, Debug)]
pub struct External<'i> {
pub value: &'i str,
pub span: Span,
Expand Down
5 changes: 1 addition & 4 deletions src/problem/messages.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1137,10 +1137,7 @@ functions calls:
function: Identifier { value: name, .. },
} => (
format!("Unknown function {}()", name),
format!(
"The function {}() is neither builtin nor provided by the selected domain.",
name
),
"The function is neither builtin nor provided by the selected domain.".to_string(),
),
}
}
Expand Down
4 changes: 3 additions & 1 deletion src/program/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -145,11 +145,13 @@ pub struct Invocable<'i> {
/// subroutine into `Program.subroutines`; the resolve pass walks the
/// translated tree replacing matching `Unresolved` references with
/// `Resolved`. Names that don't match any declared subroutine become a
/// translation error.
/// translation error. `Deferred` references (ie URLs) are left as-is; they
/// are resolved at a later phase or at runtime.
#[derive(Debug, Eq, PartialEq)]
pub enum SubroutineRef<'i> {
Unresolved(language::Identifier<'i>),
Resolved(SubroutineId),
Deferred(language::External<'i>),
}

/// Lowered form of `language::Function`. Functions live in a separate
Expand Down
5 changes: 5 additions & 0 deletions src/runner/runner.rs
Original file line number Diff line number Diff line change
Expand Up @@ -472,6 +472,11 @@ impl<'i, D: Driver> Runner<'i, D> {
.announce(&format!("<{}>", id.value));
Ok(Outcome::Done(Value::Unitus))
}
SubroutineRef::Deferred(ext) => {
self.driver
.announce(&format!("<{}>", ext.value));
Ok(Outcome::Done(Value::Unitus))
}
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/translation/translator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -745,7 +745,7 @@ impl<'i> Translator<'i> {
fn translate_invocation(&mut self, invocation: &'i language::Invocation<'i>) -> Invocable<'i> {
let target = match &invocation.target {
language::Target::Local(id) => SubroutineRef::Unresolved(*id),
language::Target::Remote(_) => todo!("remote invocation target"),
language::Target::Remote(external) => SubroutineRef::Deferred(*external),
};
let arguments = match &invocation.parameters {
Some(params) => params
Expand Down