Update convert.rs

This commit is contained in:
Shunsuke Shibayama 2023-06-08 02:38:40 +09:00
parent d36d4150bd
commit 25336075c1
1 changed files with 5 additions and 1 deletions

View File

@ -1871,7 +1871,11 @@ impl ASTConverter {
let import_acc = Expr::Accessor(Accessor::Ident(
self.convert_ident("__import__".to_string(), loc),
));
let cont = format!("\"{}\"", name.name.split('.').next().unwrap());
let cont = if name.asname.is_some() {
format!("\"{}\"", name.name.replace('.', "/"))
} else {
format!("\"{}\"", name.name.split('.').next().unwrap())
};
let mod_name = Expr::Literal(Literal::new(Token::new(
TokenKind::StrLit,
cont,