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

Function resolve_lean_name_addr

crates/kernel/src/ingress.rs:2151–2167  ·  view source on GitHub ↗

Resolve a Lean Name to an Address, using real Ixon address if available. Checks `name_to_ixon_addr` first (real compiled address), falls back to `Address::from_blake3_hash(*name.get_hash())` for constants not yet compiled.

(
  name: &Name,
  name_to_ixon_addr: Option<&DashMap<Name, Address>>,
  aux_n2a: Option<&DashMap<Name, Address>>,
)

Source from the content-addressed store, hash-verified

2149 name_to_addr: &FxHashMap<Name, Address>,
2150 intern: &mut InternTable<M>,
2151 stats: &mut ConvertStats,
2152) -> Result<Vec<(KId<M>, KConst<M>)>, String> {
2153 let block_id: KId<M> =
2154 KId::new(entry_addr.clone(), M::meta_field(entry_name.clone()));
2155
2156 let block_constant = ixon_env.get_const(entry_addr).ok_or_else(|| {
2157 format!("missing Muts block constant {}", entry_addr.hex())
2158 })?;
2159 let members = match &block_constant.info {
2160 IxonCI::Muts(m) => m,
2161 _ => return Err(format!("constant at {} is not Muts", entry_addr.hex())),
2162 };
2163
2164 let mut results: Vec<(KId<M>, KConst<M>)> = Vec::new();
2165
2166 for (i, member) in members.iter().enumerate() {
2167 // `all[i][0]` is the name-hash address of this member's canonical Lean
2168 // name; we read the per-member metadata (arena, type_root, etc.) from
2169 // that Named entry. Note the address distinction: `primary_name_addr`
2170 // is a *name-content* hash (Blake3 of the Lean name components),

Calls 4

valueMethod · 0.80
get_hashMethod · 0.80
getMethod · 0.45
cloneMethod · 0.45