mirror of
https://github.com/RustPython/Parser.git
synced 2025-07-16 17:45:24 +00:00
Return SyntaxError on Invalid Star Expression
This commit is contained in:
parent
5919a1e1ba
commit
5ce3f2c056
1 changed files with 6 additions and 4 deletions
|
@ -1616,10 +1616,12 @@ impl<O: OutputStream> Compiler<O> {
|
||||||
Comprehension { kind, generators } => {
|
Comprehension { kind, generators } => {
|
||||||
self.compile_comprehension(kind, generators)?;
|
self.compile_comprehension(kind, generators)?;
|
||||||
}
|
}
|
||||||
Starred { value } => {
|
Starred { .. } => {
|
||||||
self.compile_expression(value)?;
|
use std::string::String;
|
||||||
self.emit(Instruction::Unpack);
|
return Err(CompileError {
|
||||||
panic!("We should not just unpack a starred args, since the size is unknown.");
|
error: CompileErrorType::SyntaxError(String::from("Invalid starred expression")),
|
||||||
|
location: self.current_source_location.clone(),
|
||||||
|
});
|
||||||
}
|
}
|
||||||
IfExpression { test, body, orelse } => {
|
IfExpression { test, body, orelse } => {
|
||||||
let no_label = self.new_label();
|
let no_label = self.new_label();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue