Distinguish MultipleStarArgs and InvalidStarArgs compile errors

This commit is contained in:
Jeong YunWon 2020-05-13 01:42:18 +09:00
parent 3f2b414fcc
commit a77e0b8587
2 changed files with 9 additions and 8 deletions

View file

@ -1374,7 +1374,7 @@ impl<O: OutputStream> Compiler<O> {
for (i, element) in elements.iter().enumerate() {
if let ast::ExpressionType::Starred { .. } = &element.node {
if seen_star {
return Err(self.error(CompileErrorType::StarArgs));
return Err(self.error(CompileErrorType::MultipleStarArgs));
} else {
seen_star = true;
self.emit(Instruction::UnpackEx {
@ -1782,11 +1782,7 @@ impl<O: OutputStream> Compiler<O> {
self.compile_comprehension(kind, generators)?;
}
Starred { .. } => {
return Err(
self.error(CompileErrorType::SyntaxError(std::string::String::from(
"Invalid starred expression",
))),
);
return Err(self.error(CompileErrorType::InvalidStarExpr));
}
IfExpression { test, body, orelse } => {
let no_label = self.new_label();