refactor(tvix/eval): after calling, the caller has to pop
Previously the various call functions either returned `EvalResult<()>` or `EvalResult<Value>`, which was confusing. Now only vm::call_with returns a Value directly, and other parts of the API just leave the stack top in the post-call state. This makes it easier to reason about what's going on in non-tail-call cases (which are making a comeback). Change-Id: I264ffc683a11aca72dd06e2220a5ff6e7c5fc2b0 Reviewed-on: https://cl.tvl.fyi/c/depot/+/6936 Tested-by: BuildkiteCI Reviewed-by: grfn <grfn@gws.fyi>
This commit is contained in:
parent
0b04dfe03c
commit
1f84d90811
3 changed files with 29 additions and 21 deletions
|
|
@ -163,7 +163,8 @@ impl Value {
|
|||
let call_to_string = |value: &Value, vm: &mut VM| {
|
||||
// Leave self on the stack as an argument to the function call.
|
||||
vm.push(self.clone());
|
||||
let result = vm.call_value(value)?;
|
||||
vm.call_value(value)?;
|
||||
let result = vm.pop();
|
||||
|
||||
match result {
|
||||
Value::String(s) => Ok(s),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue