From da1d71a4e8e3afee09d8f72b79b6042d4ccbfc2d Mon Sep 17 00:00:00 2001 From: sterni Date: Tue, 13 Sep 2022 15:37:19 +0200 Subject: feat(tvix/eval): implement correct toString behavior Implement C++ Nix's `EvalState::coerceToString` minus some of the Path / store handling. This is currently only used for `toString` which does all possible coercions, but we've already prepared the weaker coercion variant which is e.g. used for builtins that expect string arguments. `EvalState::coerceToPath` is still missing for builtins that need a path, but it'll be easy to build on top of this. Change-Id: I78d15576b18921791d04b6b1e964b951fdef22c6 Reviewed-on: https://cl.tvl.fyi/c/depot/+/6571 Autosubmit: sterni Reviewed-by: tazjin Tested-by: BuildkiteCI --- tvix/eval/src/vm.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'tvix/eval/src/vm.rs') diff --git a/tvix/eval/src/vm.rs b/tvix/eval/src/vm.rs index d886bf24b9..6fe94184b8 100644 --- a/tvix/eval/src/vm.rs +++ b/tvix/eval/src/vm.rs @@ -148,11 +148,11 @@ impl<'o> VM<'o> { op } - fn pop(&mut self) -> Value { + pub fn pop(&mut self) -> Value { self.stack.pop().expect("runtime stack empty") } - fn push(&mut self, value: Value) { + pub fn push(&mut self, value: Value) { self.stack.push(value) } @@ -726,7 +726,7 @@ impl<'o> VM<'o> { } } - fn call_builtin(&mut self, builtin: Builtin) -> EvalResult<()> { + pub fn call_builtin(&mut self, builtin: Builtin) -> EvalResult<()> { let builtin_name = builtin.name(); self.observer.observe_enter_builtin(builtin_name); -- cgit 1.4.1