fix: module member resolution bug

This commit is contained in:
Shunsuke Shibayama 2023-06-29 15:51:35 +09:00
parent 7f2c0301e2
commit 53cd052dc3
5 changed files with 36 additions and 10 deletions

View file

@ -2584,7 +2584,10 @@ impl PyCodeGenerator {
fn emit_import(&mut self, acc: Accessor) {
self.emit_load_const(0i32);
self.emit_load_const(ValueObj::None);
let full_name = Str::from(acc.show());
let full_name = Str::from(
acc.qual_name()
.map_or(acc.show(), |s| s.replace(".__init__", "")),
);
let name = self
.local_search(&full_name, Name)
.unwrap_or_else(|| self.register_name(full_name));