@@ -78,15 +78,15 @@ pub fn compile(
78
78
match mode {
79
79
Mode :: Exec => {
80
80
let ast = parser:: parse_program ( source) ?;
81
- compile_program ( ast, source_path. clone ( ) , opts)
81
+ compile_program ( ast, source_path, opts)
82
82
}
83
83
Mode :: Eval => {
84
84
let statement = parser:: parse_statement ( source) ?;
85
- compile_statement_eval ( statement, source_path. clone ( ) , opts)
85
+ compile_statement_eval ( statement, source_path, opts)
86
86
}
87
87
Mode :: Single => {
88
88
let ast = parser:: parse_program ( source) ?;
89
- compile_program_single ( ast, source_path. clone ( ) , opts)
89
+ compile_program_single ( ast, source_path, opts)
90
90
}
91
91
}
92
92
}
@@ -2141,12 +2141,7 @@ impl<O: OutputStream> Compiler<O> {
2141
2141
features : & [ ast:: ImportSymbol ] ,
2142
2142
) -> Result < ( ) , CompileError > {
2143
2143
if self . done_with_future_stmts {
2144
- return Err ( CompileError {
2145
- error : CompileErrorType :: InvalidFuturePlacement ,
2146
- location : self . current_source_location . clone ( ) ,
2147
- source_path : self . source_path . clone ( ) ,
2148
- statement : None ,
2149
- } ) ;
2144
+ return Err ( self . error ( CompileErrorType :: InvalidFuturePlacement ) ) ;
2150
2145
}
2151
2146
for feature in features {
2152
2147
match & * feature. symbol {
@@ -2156,12 +2151,7 @@ impl<O: OutputStream> Compiler<O> {
2156
2151
// "generator_stop" => {}
2157
2152
// "annotations" => {}
2158
2153
other => {
2159
- return Err ( CompileError {
2160
- error : CompileErrorType :: InvalidFutureFeature ( other. to_owned ( ) ) ,
2161
- location : self . current_source_location . clone ( ) ,
2162
- source_path : self . source_path . clone ( ) ,
2163
- statement : None ,
2164
- } )
2154
+ return Err ( self . error ( CompileErrorType :: InvalidFutureFeature ( other. to_owned ( ) ) ) )
2165
2155
}
2166
2156
}
2167
2157
}
0 commit comments