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

Function decode_syntax_preresolved

crates/ffi/src/lean_env.rs:699–721  ·  view source on GitHub ↗
(
  obj: LeanBorrowed<'_>,
  cache: &mut Cache<'_>,
)

Source from the content-addressed store, hash-verified

697 return cached.clone();
698 }
699 let level = if obj.is_scalar() {
700 Level::zero()
701 } else {
702 let l = LeanIxLevel::from_ctor(obj.as_ctor());
703 match l.as_ctor().tag() {
704 1 => Level::succ(decode_level(l.get_obj(0), cache)),
705 2 => Level::max(
706 decode_level(l.get_obj(0), cache),
707 decode_level(l.get_obj(1), cache),
708 ),
709 3 => Level::imax(
710 decode_level(l.get_obj(0), cache),
711 decode_level(l.get_obj(1), cache),
712 ),
713 4 => Level::param(decode_name(l.get_obj(0), cache.global)),
714 5 => Level::mvar(decode_name(l.get_obj(0), cache.global)),
715 tag => unreachable!("Invalid Lean.Level tag: {tag}"),
716 }
717 };
718 cache.local.univs.insert(ptr, level.clone());
719 level
720}
721
722fn decode_substring(obj: LeanBorrowed<'_>) -> Substring {
723 let s = LeanIxSubstring::from_ctor(obj.as_ctor());
724 let str = s.get_obj(0).as_string().to_string();

Callers 1

decode_syntaxFunction · 0.85

Calls 3

decode_nameFunction · 0.85
tagMethod · 0.80
iterMethod · 0.45

Tested by

no test coverage detected