rewrite VM to support reentry (WIP)
This commit is contained in:
@@ -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))
|
||||
|
||||
Reference in New Issue
Block a user