mirror of
https://github.com/erg-lang/erg.git
synced 2025-10-02 21:44:34 +00:00
Split cache between Python and Erg modules
This commit is contained in:
parent
5916096cc4
commit
5aae4a69a5
22 changed files with 521 additions and 258 deletions
|
@ -20,6 +20,7 @@ use erg_type::value::{TypeKind, ValueObj};
|
|||
use erg_type::{impl_t, impl_t_for_enum, HasType, Type};
|
||||
|
||||
use crate::context::eval::type_from_token_kind;
|
||||
use crate::context::ImportKind;
|
||||
use crate::error::readable_name;
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
|
@ -1006,11 +1007,12 @@ impl Call {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn is_import_call(&self) -> bool {
|
||||
self.obj
|
||||
.show_acc()
|
||||
.map(|s| &s[..] == "import" || &s[..] == "pyimport" || &s[..] == "py")
|
||||
.unwrap_or(false)
|
||||
pub fn import_kind(&self) -> Option<ImportKind> {
|
||||
self.obj.show_acc().and_then(|s| match &s[..] {
|
||||
"import" => Some(ImportKind::ErgImport),
|
||||
"pyimport" | "py" => Some(ImportKind::PyImport),
|
||||
_ => None,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1332,7 +1334,7 @@ impl Def {
|
|||
DefKind::Other
|
||||
}
|
||||
}
|
||||
Some("import") => DefKind::Module,
|
||||
Some("import") => DefKind::Import,
|
||||
_ => DefKind::Other,
|
||||
},
|
||||
_ => DefKind::Other,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue