mirror of
https://github.com/erg-lang/erg.git
synced 2025-09-29 04:24:43 +00:00
Merge branch 'main' into shape
This commit is contained in:
commit
278039c75b
1 changed files with 11 additions and 0 deletions
|
@ -2639,6 +2639,17 @@ impl Context {
|
|||
}
|
||||
|
||||
pub(crate) fn get_namespace_path(&self, namespace: &Str) -> Option<PathBuf> {
|
||||
// get the true name
|
||||
let namespace = if let Some((_, vi)) = self.get_var_info(namespace) {
|
||||
// m: PyModule("math") -> math
|
||||
if vi.t.is_module() {
|
||||
vi.t.typarams()[0].to_string().replace('"', "").into()
|
||||
} else {
|
||||
namespace.clone()
|
||||
}
|
||||
} else {
|
||||
namespace.clone()
|
||||
};
|
||||
let mut namespaces = namespace.split_with(&[".", "::"]);
|
||||
let mut str_namespace = namespaces.first().map(|n| n.to_string())?;
|
||||
namespaces.remove(0);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue