refactor(tvix/eval): insert storeDir "builtin" in eval startup
Instead of using a suspended native thunk, calculate and optionally insert the storeDir builtin when the VM is constructed. We already have the IO handle available at this point and can just check whether a storeDir is present, and insert its absolute value as a builtin. Change-Id: If966eee6ff26dc888b6e888e7c46170c0c346b05 Reviewed-on: https://cl.tvl.fyi/c/depot/+/8145 Reviewed-by: raitobezarius <tvl@lahfa.xyz> Tested-by: BuildkiteCI
This commit is contained in:
parent
e1f082a3ab
commit
38fd3cb292
2 changed files with 5 additions and 10 deletions
|
@ -219,6 +219,11 @@ impl<'code, 'co, 'ro> Evaluation<'code, 'co, 'ro> {
|
|||
let mut noop_observer = observer::NoOpObserver::default();
|
||||
let compiler_observer = self.compiler_observer.take().unwrap_or(&mut noop_observer);
|
||||
|
||||
// Insert a storeDir builtin *iff* a store directory is present.
|
||||
if let Some(store_dir) = self.io_handle.store_dir() {
|
||||
self.builtins.push(("storeDir", store_dir.into()));
|
||||
}
|
||||
|
||||
let (lambda, globals) = match parse_compile_internal(
|
||||
&mut result,
|
||||
self.code,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue