(&mut self, expression: &ast::Expr)
| 2756 | } |
| 2757 | |
| 2758 | fn compile_delete(&mut self, expression: &ast::Expr) -> CompileResult<()> { |
| 2759 | match &expression { |
| 2760 | ast::Expr::Name(ast::ExprName { id, .. }) => { |
| 2761 | self.compile_name(id.as_str(), NameUsage::Delete)? |
| 2762 | } |
| 2763 | ast::Expr::Attribute(ast::ExprAttribute { value, attr, .. }) => { |
| 2764 | self.compile_expression(value)?; |
| 2765 | let namei = self.name(attr.as_str()); |
| 2766 | emit!(self, Instruction::DeleteAttr { namei }); |
| 2767 | } |
| 2768 | ast::Expr::Subscript(ast::ExprSubscript { |
| 2769 | value, slice, ctx, .. |
| 2770 | }) => { |
| 2771 | self.compile_subscript(value, slice, *ctx)?; |
| 2772 | } |
| 2773 | ast::Expr::Tuple(ast::ExprTuple { elts, .. }) |
| 2774 | | ast::Expr::List(ast::ExprList { elts, .. }) => { |
| 2775 | for element in elts { |
| 2776 | self.compile_delete(element)?; |
| 2777 | } |
| 2778 | } |
| 2779 | ast::Expr::BinOp(_) | ast::Expr::UnaryOp(_) => { |
| 2780 | return Err(self.error(CodegenErrorType::Delete("expression"))); |
| 2781 | } |
| 2782 | _ => return Err(self.error(CodegenErrorType::Delete(expression.python_name()))), |
| 2783 | } |
| 2784 | Ok(()) |
| 2785 | } |
| 2786 | |
| 2787 | fn enter_function(&mut self, name: &str, parameters: &ast::Parameters) -> CompileResult<()> { |
| 2788 | // TODO: partition_in_place |
no test coverage detected