MCPcopy Create free account
hub / github.com/bytecodealliance/wit-bindgen / qualify_package

Method qualify_package

crates/moonbit/src/pkg.rs:36–54  ·  view source on GitHub ↗
(&mut self, this: &str, name: &str)

Source from the content-addressed store, hash-verified

34
35impl PkgResolver {
36 pub(crate) fn qualify_package(&mut self, this: &str, name: &str) -> String {
37 if name != this {
38 let imports = self.package_import.entry(this.to_string()).or_default();
39 if let Some(alias) = imports.packages.get(name) {
40 format!("@{alias}.")
41 } else {
42 let alias = imports
43 .ns
44 .tmp(&name.split(".").last().unwrap().to_lower_camel_case());
45 imports
46 .packages
47 .entry(name.to_string())
48 .or_insert(alias.clone());
49 format!("@{alias}.")
50 }
51 } else {
52 "".into()
53 }
54 }
55
56 pub(crate) fn qualifier(&mut self, this: &str, ty: &TypeDef) -> String {
57 if let TypeOwner::Interface(id) = &ty.owner {

Callers 10

qualifierMethod · 0.80
type_nameMethod · 0.80
exportMethod · 0.80
resolve_pkgMethod · 0.80
emitMethod · 0.80
malloc_memoryMethod · 0.80
list_lift_from_memoryMethod · 0.80
list_lower_to_memoryMethod · 0.80

Calls 3

to_stringMethod · 0.45
getMethod · 0.45
tmpMethod · 0.45

Tested by

no test coverage detected