MCPcopy Create free account
hub / github.com/argumentcomputer/ix / lookup_var

Method lookup_var

crates/kernel/src/tc.rs:627–636  ·  view source on GitHub ↗

Look up a bound variable's type, lifted to the current depth.

(&mut self, idx: u64)

Source from the content-addressed store, hash-verified

625 /// later or in parallel). Returns the fvar id and the interned fvar
626 /// expression.
627 pub fn push_fvar_decl_anon(&mut self, ty: KExpr<M>) -> (FVarId, KExpr<M>) {
628 let name = M::meta_field(ix_common::env::Name::anon());
629 let bi = M::meta_field(ix_common::env::BinderInfo::Default);
630 let fv_id = self.fresh_fvar_id();
631 let fv = self.intern(KExpr::fvar(fv_id, name.clone()));
632 self.lctx.push(fv_id, LocalDecl::CDecl { name, bi, ty });
633 (fv_id, fv)
634 }
635
636 /// Look up a bound variable's type, lifted to the current depth.
637 pub fn lookup_var(&mut self, idx: u64) -> Result<KExpr<M>, TcError<M>> {
638 let n = self.ctx.len();
639 let idx_us = u64_to_usize::<M>(idx)?;

Callers 3

lookup_var_out_of_rangeFunction · 0.80
inferMethod · 0.80

Calls 3

liftFunction · 0.85
lenMethod · 0.45
cloneMethod · 0.45

Tested by 2

lookup_var_out_of_rangeFunction · 0.64