(&mut self, features: &[ast::Alias])
| 9334 | } |
| 9335 | |
| 9336 | fn compile_future_features(&mut self, features: &[ast::Alias]) -> Result<(), CodegenError> { |
| 9337 | if let DoneWithFuture::Yes = self.done_with_future_stmts { |
| 9338 | return Err(self.error(CodegenErrorType::InvalidFuturePlacement)); |
| 9339 | } |
| 9340 | self.done_with_future_stmts = DoneWithFuture::DoneWithDoc; |
| 9341 | for feature in features { |
| 9342 | match feature.name.as_str() { |
| 9343 | // Python 3 features; we've already implemented them by default |
| 9344 | "nested_scopes" | "generators" | "division" | "absolute_import" |
| 9345 | | "with_statement" | "print_function" | "unicode_literals" | "generator_stop" => {} |
| 9346 | "annotations" => self.future_annotations = true, |
| 9347 | other => { |
| 9348 | return Err( |
| 9349 | self.error(CodegenErrorType::InvalidFutureFeature(other.to_owned())) |
| 9350 | ); |
| 9351 | } |
| 9352 | } |
| 9353 | } |
| 9354 | Ok(()) |
| 9355 | } |
| 9356 | |
| 9357 | // Low level helper functions: |
| 9358 | fn _emit<I: Into<AnyInstruction>>(&mut self, instr: I, arg: OpArg, target: BlockIdx) { |
no test coverage detected