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

Function name_replace_prefix

crates/compile/src/compile/aux_gen/nested.rs:1407–1416  ·  view source on GitHub ↗

Replace `old_prefix` in a Name with `new_prefix`. Example: `name_replace_prefix("A.B.mk", "A.B", "X.Y")` → `"X.Y.mk"`

(
  name: &Name,
  old_prefix: &Name,
  new_prefix: &Name,
)

Source from the content-addressed store, hash-verified

1405/// diamond-shaped types (a `TensorProduct` with shared param subterms
1406/// fans out). With memoization each unique subterm is visited once.
1407fn has_out_of_scc_const(
1408 expr: &LeanExpr,
1409 in_scc_names: &std::collections::HashMap<Name, Name>,
1410 original_names: &std::collections::HashSet<Name>,
1411 cache: &mut FxHashMap<Hash, bool>,
1412) -> bool {
1413 let key = *expr.get_hash();
1414 if let Some(&cached) = cache.get(&key) {
1415 return cached;
1416 }
1417 let result = match expr.as_data() {
1418 ExprData::Const(name, _, _) => {
1419 original_names.contains(name) && !in_scc_names.contains_key(name)

Callers 2

replace_if_nestedMethod · 0.85

Calls 3

strip_prefixMethod · 0.80
append_componentsMethod · 0.80
cloneMethod · 0.45

Tested by

no test coverage detected