refactor(tvix/eval): reduce fetch{forced|captured}_with visibility

This commit moves fetch_forced_with and fetch_captured_with into the
scope of their only caller (resolve_with).

Change-Id: I9a8bc27228888729d591e8cb021c431b2b6468f5
Reviewed-on: https://cl.tvl.fyi/c/depot/+/8289
Autosubmit: Adam Joseph <adam@westernsemico.com>
Reviewed-by: tazjin <tazjin@tvl.su>
Tested-by: BuildkiteCI
This commit is contained in:
Adam Joseph 2023-03-13 05:53:46 -07:00 committed by tazjin
parent 47895c4c30
commit e7a534e0c6

View file

@ -998,6 +998,14 @@ impl<'o> VM<'o> {
} }
} }
/// Resolve a dynamically bound identifier (through `with`) by looking
/// for matching values in the with-stacks carried at runtime.
async fn resolve_with(
co: GenCo,
ident: String,
vm_with_len: usize,
upvalue_with_len: usize,
) -> Result<Value, ErrorKind> {
/// Fetch and force a value on the with-stack from the VM. /// Fetch and force a value on the with-stack from the VM.
async fn fetch_forced_with(co: &GenCo, idx: usize) -> Value { async fn fetch_forced_with(co: &GenCo, idx: usize) -> Value {
match co.yield_(GeneratorRequest::WithValue(idx)).await { match co.yield_(GeneratorRequest::WithValue(idx)).await {
@ -1020,14 +1028,6 @@ async fn fetch_captured_with(co: &GenCo, idx: usize) -> Value {
} }
} }
/// Resolve a dynamically bound identifier (through `with`) by looking
/// for matching values in the with-stacks carried at runtime.
async fn resolve_with(
co: GenCo,
ident: String,
vm_with_len: usize,
upvalue_with_len: usize,
) -> Result<Value, ErrorKind> {
for with_stack_idx in (0..vm_with_len).rev() { for with_stack_idx in (0..vm_with_len).rev() {
// TODO(tazjin): is this branch still live with the current with-thunking? // TODO(tazjin): is this branch still live with the current with-thunking?
let with = fetch_forced_with(&co, with_stack_idx).await; let with = fetch_forced_with(&co, with_stack_idx).await;