mirror of
https://github.com/RustPython/Parser.git
synced 2025-09-01 08:07:50 +00:00
Fix panic on import statement with levels but no module name.
This commit is contained in:
parent
69c4d0b240
commit
91b43d47fb
1 changed files with 3 additions and 3 deletions
|
@ -271,7 +271,7 @@ impl Compiler {
|
||||||
// import a, b, c as d
|
// import a, b, c as d
|
||||||
for name in names {
|
for name in names {
|
||||||
self.emit(Instruction::Import {
|
self.emit(Instruction::Import {
|
||||||
name: name.symbol.clone(),
|
name: Some(name.symbol.clone()),
|
||||||
symbols: vec![],
|
symbols: vec![],
|
||||||
level: 0,
|
level: 0,
|
||||||
});
|
});
|
||||||
|
@ -293,7 +293,7 @@ impl Compiler {
|
||||||
if import_star {
|
if import_star {
|
||||||
// from .... import *
|
// from .... import *
|
||||||
self.emit(Instruction::ImportStar {
|
self.emit(Instruction::ImportStar {
|
||||||
name: module.clone().unwrap(),
|
name: module.clone(),
|
||||||
level: *level,
|
level: *level,
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
|
@ -303,7 +303,7 @@ impl Compiler {
|
||||||
|
|
||||||
// Load module once:
|
// Load module once:
|
||||||
self.emit(Instruction::Import {
|
self.emit(Instruction::Import {
|
||||||
name: module.clone().unwrap(),
|
name: module.clone(),
|
||||||
symbols: from_list,
|
symbols: from_list,
|
||||||
level: *level,
|
level: *level,
|
||||||
});
|
});
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue