From 5ce3f2c0566a27152dcc6bea7203aeaf3d8fd053 Mon Sep 17 00:00:00 2001 From: j30ng Date: Thu, 12 Sep 2019 03:15:03 +0900 Subject: [PATCH] Return SyntaxError on Invalid Star Expression --- src/compile.rs | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/compile.rs b/src/compile.rs index 7194c88..b42496a 100644 --- a/src/compile.rs +++ b/src/compile.rs @@ -1616,10 +1616,12 @@ impl Compiler { Comprehension { kind, generators } => { self.compile_comprehension(kind, generators)?; } - Starred { value } => { - self.compile_expression(value)?; - self.emit(Instruction::Unpack); - panic!("We should not just unpack a starred args, since the size is unknown."); + Starred { .. } => { + use std::string::String; + return Err(CompileError { + error: CompileErrorType::SyntaxError(String::from("Invalid starred expression")), + location: self.current_source_location.clone(), + }); } IfExpression { test, body, orelse } => { let no_label = self.new_label();