MCPcopy Create free account
hub / github.com/LPC4/Full-Stack / expr

Method expr

crates/hll-to-ir/src/imports.rs:877–902  ·  view source on GitHub ↗
(&mut self, expr: &mut Expression)

Source from the content-addressed store, hash-verified

875 targets.remove(name);
876 }
877 if targets.is_empty() {
878 return;
879 }
880 mangle_with_targets(program, prefix, targets, &HashSet::new());
881}
882
883// Rename `targets` (definitions and unshadowed references) to `prefix__name`, returning
884// the `rejected` names the walk saw as live references.
885fn mangle_with_targets(
886 program: &mut Program,
887 prefix: &str,
888 targets: HashSet<String>,
889 rejected: &HashSet<String>,
890) -> Vec<String> {
891 let mut mangler = Mangler {
892 prefix,
893 targets,
894 rejected,
895 seen_rejected: Vec::new(),
896 scopes: Vec::new(),
897 };
898 mangler.run(program);
899 mangler.seen_rejected
900}
901
902// Walks an AST renaming references to a module's mangled top-level symbols, honoring local
903// bindings (params, locals, loop and match bindings) that shadow a top-level name.
904struct Mangler<'a> {
905 prefix: &'a str,

Callers 4

runMethod · 0.80
stmtMethod · 0.80
primaryMethod · 0.80
assign_targetMethod · 0.80

Calls 6

pattern_bindingsFunction · 0.85
assign_targetMethod · 0.80
pushMethod · 0.80
blockMethod · 0.80
popMethod · 0.80
primaryMethod · 0.80

Tested by

no test coverage detected