rewrite VM to support reentry (WIP)

This commit is contained in:
2026-03-22 16:41:13 +08:00
parent b3f1f4f6ff
commit 6567ed4058
18 changed files with 1728 additions and 3315 deletions
+2 -3
View File
@@ -14,12 +14,11 @@ fn eval_file(name: &str) -> Result<(Value, Source), String> {
let lang_dir = get_lang_dir();
let nix_path = lang_dir.join(format!("{name}.nix"));
let expr = format!(r#"import "{}""#, nix_path.display());
let mut ctx = Runtime::new().map_err(|e| e.to_string())?;
let content = std::fs::read_to_string(&nix_path).unwrap();
let source = Source {
ty: fix::error::SourceType::File(nix_path.into()),
src: expr.into(),
src: content.into(),
};
ctx.eval_deep(source.clone())
.map(|val| (val, source))