feat(tvix/eval): add Evaluation::compile_only method

This would make it possible to implement something like a linter based
on the tvix-eval compiler warnings.

Change-Id: I1feb4e7c4a44be7d1204b0a962ab522fd32b93c6
Reviewed-on: https://cl.tvl.fyi/c/depot/+/7763
Tested-by: BuildkiteCI
Reviewed-by: flokli <flokli@flokli.de>
This commit is contained in:
Vincent Ambo 2023-01-05 12:43:24 +03:00 committed by tazjin
parent 27fecee1bc
commit 5926a05f46
2 changed files with 101 additions and 49 deletions

View file

@ -47,6 +47,8 @@ pub struct CompilationOutput {
// This field must outlive the rc::Weak reference which breaks
// the builtins -> import -> builtins reference cycle.
//
// TODO: ensure through compiler
pub globals: Rc<GlobalsMap>,
}
@ -82,7 +84,7 @@ pub type Global = Rc<dyn Fn(&mut Compiler, Span)>;
/// The map of globally available functions that should implicitly
/// be resolvable in the global scope.
type GlobalsMap = HashMap<&'static str, Rc<dyn Fn(&mut Compiler, Span)>>;
pub(crate) type GlobalsMap = HashMap<&'static str, Rc<dyn Fn(&mut Compiler, Span)>>;
/// Set of builtins that (if they exist) should be made available in
/// the global scope, meaning that they can be accessed not just