cl-interpret: Complain, rather than panic, on outlined module
This commit is contained in:
parent
58c5a01312
commit
d692f6bb80
@ -60,10 +60,11 @@ impl Interpret for Static {
|
||||
}
|
||||
impl Interpret for Module {
|
||||
fn interpret(&self, env: &mut Environment) -> IResult<ConValue> {
|
||||
let Self { name, kind } = self;
|
||||
// TODO: Enter this module's namespace
|
||||
match &self.kind {
|
||||
match kind {
|
||||
ModuleKind::Inline(file) => file.interpret(env),
|
||||
ModuleKind::Outline => todo!("Load and parse external files"),
|
||||
ModuleKind::Outline => Err(Error::Outlined(*name)),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -580,7 +580,7 @@ pub mod error {
|
||||
want: usize,
|
||||
got: usize,
|
||||
},
|
||||
NullPointer,
|
||||
Outlined(Sym),
|
||||
}
|
||||
|
||||
impl std::error::Error for Error {}
|
||||
@ -620,8 +620,8 @@ pub mod error {
|
||||
if *want == 1 { "" } else { "s" }
|
||||
)
|
||||
}
|
||||
Error::NullPointer => {
|
||||
write!(f, "Attempted to dereference a null pointer?")
|
||||
Error::Outlined(name) => {
|
||||
write!(f, "Module {name} specified, but not imported.")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user