refactor(tvix/eval): use EvalIO::read_to_string in impure builtins

With this change, the behaviour of reading a string from a file path
is controlled by the provided `EvalIO` structure.

This is a huge step towards abstracting away I/O behaviour correctly.

Change-Id: Ifde8e46cd863b16e0301dca45a434ad27560399f
Reviewed-on: https://cl.tvl.fyi/c/depot/+/7567
Tested-by: BuildkiteCI
Reviewed-by: grfn <grfn@gws.fyi>
This commit is contained in:
Vincent Ambo 2022-12-12 17:57:03 +03:00 committed by tazjin
parent c3c4d752c9
commit 0ef3c2fc2b
3 changed files with 21 additions and 38 deletions

View file

@ -220,6 +220,11 @@ impl<'o> VM<'o> {
self.chunk().get_span(self.frame().ip - 1)
}
/// Access the I/O handle used for filesystem access in this VM.
pub(crate) fn io(&self) -> &Box<dyn EvalIO> {
&self.io_handle
}
/// Returns the information needed to calculate the current span,
/// but without performing that calculation.
fn current_light_span(&self) -> LightSpan {