cl-interpret: Make ConValues act like value types

(Aside from the fact that they're smothered in heap allocations)
This commit is contained in:
2025-01-28 06:20:10 -06:00
parent 01871bf455
commit 485afb7843
2 changed files with 33 additions and 8 deletions

View File

@@ -67,11 +67,21 @@ 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 kind {
env.push_frame(Interned::to_ref(name), Default::default());
let out = match kind {
ModuleKind::Inline(file) => file.interpret(env),
ModuleKind::Outline => Err(Error::Outlined(*name)),
}
ModuleKind::Outline => {
eprintln!("{}", Error::Outlined(*name));
Ok(ConValue::Empty)
}
};
let frame = env
.pop_frame()
.expect("Environment frames must be balanced");
env.insert(*name, Some(ConValue::Module(frame.into())));
out
}
}
impl Interpret for Function {