about summary refs log tree commit diff
path: root/tvix/eval/src/compiler.rs
diff options
context:
space:
mode:
Diffstat (limited to 'tvix/eval/src/compiler.rs')
-rw-r--r--tvix/eval/src/compiler.rs11
1 files changed, 6 insertions, 5 deletions
diff --git a/tvix/eval/src/compiler.rs b/tvix/eval/src/compiler.rs
index 1bbd791876ab..cb97b61c989e 100644
--- a/tvix/eval/src/compiler.rs
+++ b/tvix/eval/src/compiler.rs
@@ -1029,7 +1029,11 @@ fn prepare_globals(additional: HashMap<&'static str, Value>) -> GlobalsMap {
     globals
 }
 
-pub fn compile(expr: ast::Expr, location: Option<PathBuf>) -> EvalResult<CompilationResult> {
+pub fn compile(
+    expr: ast::Expr,
+    location: Option<PathBuf>,
+    globals: HashMap<&'static str, Value>,
+) -> EvalResult<CompilationResult> {
     let mut root_dir = match location {
         Some(dir) => Ok(dir),
         None => std::env::current_dir().map_err(|e| {
@@ -1044,12 +1048,9 @@ pub fn compile(expr: ast::Expr, location: Option<PathBuf>) -> EvalResult<Compila
         root_dir.pop();
     }
 
-    // TODO: accept globals as an external parameter
-    let globals = prepare_globals(HashMap::new());
-
     let mut c = Compiler {
         root_dir,
-        globals,
+        globals: prepare_globals(globals),
         contexts: vec![LambdaCtx::new()],
         warnings: vec![],
         errors: vec![],