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

Function compare_ctor

crates/compile/src/compile.rs:2646–2669  ·  view source on GitHub ↗

Compare two constructors with result caching (keyed by name pair).

(
  x: &ConstructorVal,
  y: &ConstructorVal,
  mut_ctx: &MutCtx,
  cache: &mut BlockCache,
  stt: &CompileState,
)

Source from the content-addressed store, hash-verified

2644 let surgery_sharing = std::mem::take(&mut cache.surgery_sharing);
2645 let meta_univs: Vec<Arc<Univ>> =
2646 std::mem::take(&mut cache.meta_univs).into_iter().collect();
2647 let univ_patches = std::mem::take(&mut cache.univ_patches);
2648 cache.arena_roots.clear();
2649 cache.exprs.clear();
2650
2651 let name_addr = compile_name(&val.cnst.name, stt);
2652 let lvl_addrs: Vec<Address> =
2653 univ_params.iter().map(|n| compile_name(n, stt)).collect();
2654
2655 let data =
2656 Axiom { is_unsafe: val.is_unsafe, lvls: univ_params.len() as u64, typ };
2657
2658 let mut meta = ConstantMeta::new(ConstantMetaInfo::Axio {
2659 name: name_addr,
2660 lvls: lvl_addrs,
2661 arena,
2662 type_root,
2663 });
2664 meta.meta_sharing = surgery_sharing;
2665 meta.meta_univs = meta_univs;
2666 meta.univ_patches = univ_patches;
2667
2668 Ok((data, meta))
2669}
2670
2671/// Compile a Quotient.
2672fn compile_quotient(

Callers 1

compare_indcFunction · 0.85

Calls 4

compare_ctor_innerFunction · 0.85
cloneMethod · 0.45
getMethod · 0.45
insertMethod · 0.45

Tested by

no test coverage detected