From ea69be5da534dbed10ca9b9dfa81140736757e01 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 --- compiler/src/compile.rs | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/compiler/src/compile.rs b/compiler/src/compile.rs index 7194c8886..b42496ad8 100644 --- a/compiler/src/compile.rs +++ b/compiler/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();