From e7f4720089402baf083762bd00651343440559d7 Mon Sep 17 00:00:00 2001 From: Dhruv Manilawala Date: Mon, 24 Jul 2023 18:32:44 +0530 Subject: [PATCH] New AST nodes `todo!()` --- crates/ruff_python_ast/src/comparable.rs | 1 + crates/ruff_python_ast/src/node.rs | 8 ++++++++ crates/ruff_python_formatter/src/expression/mod.rs | 3 +++ crates/ruff_python_formatter/src/statement/mod.rs | 1 + 4 files changed, 13 insertions(+) diff --git a/crates/ruff_python_ast/src/comparable.rs b/crates/ruff_python_ast/src/comparable.rs index 2825347f0d46da..8351c99795ee92 100644 --- a/crates/ruff_python_ast/src/comparable.rs +++ b/crates/ruff_python_ast/src/comparable.rs @@ -1479,6 +1479,7 @@ impl<'a> From<&'a ast::Stmt> for ComparableStmt<'a> { ast::Stmt::Pass(_) => Self::Pass, ast::Stmt::Break(_) => Self::Break, ast::Stmt::Continue(_) => Self::Continue, + ast::Stmt::LineMagic(_) => todo!(), } } } diff --git a/crates/ruff_python_ast/src/node.rs b/crates/ruff_python_ast/src/node.rs index ed1ab59a9e1842..4cb56bfb42c9ff 100644 --- a/crates/ruff_python_ast/src/node.rs +++ b/crates/ruff_python_ast/src/node.rs @@ -3153,7 +3153,11 @@ impl From for AnyNode { Stmt::Pass(node) => AnyNode::StmtPass(node), Stmt::Break(node) => AnyNode::StmtBreak(node), Stmt::Continue(node) => AnyNode::StmtContinue(node), +<<<<<<< HEAD Stmt::LineMagic(node) => AnyNode::StmtLineMagic(node), +======= + Stmt::LineMagic(_) => todo!(), +>>>>>>> 4d5259219 (New AST nodes `todo!()`) } } } @@ -3188,7 +3192,11 @@ impl From for AnyNode { Expr::List(node) => AnyNode::ExprList(node), Expr::Tuple(node) => AnyNode::ExprTuple(node), Expr::Slice(node) => AnyNode::ExprSlice(node), +<<<<<<< HEAD Expr::LineMagic(node) => AnyNode::ExprLineMagic(node), +======= + Expr::LineMagic(_) => todo!(), +>>>>>>> 4d5259219 (New AST nodes `todo!()`) } } } diff --git a/crates/ruff_python_formatter/src/expression/mod.rs b/crates/ruff_python_formatter/src/expression/mod.rs index fae56271ac0a2c..b146a35f6b5c5a 100644 --- a/crates/ruff_python_formatter/src/expression/mod.rs +++ b/crates/ruff_python_formatter/src/expression/mod.rs @@ -92,6 +92,7 @@ impl FormatRule> for FormatExpr { Expr::List(expr) => expr.format().fmt(f), Expr::Tuple(expr) => expr.format().fmt(f), Expr::Slice(expr) => expr.format().fmt(f), + Expr::LineMagic(_) => todo!(), }); let parenthesize = match parentheses { @@ -233,6 +234,7 @@ impl NeedsParentheses for Expr { Expr::List(expr) => expr.needs_parentheses(parent, context), Expr::Tuple(expr) => expr.needs_parentheses(parent, context), Expr::Slice(expr) => expr.needs_parentheses(parent, context), + Expr::LineMagic(_) => todo!(), } } } @@ -405,6 +407,7 @@ impl<'input> CanOmitOptionalParenthesesVisitor<'input> { | Expr::Starred(_) | Expr::Name(_) | Expr::Slice(_) => {} + Expr::LineMagic(_) => todo!(), }; walk_expr(self, expr); diff --git a/crates/ruff_python_formatter/src/statement/mod.rs b/crates/ruff_python_formatter/src/statement/mod.rs index 850693e32df0d9..8996aab81a03e8 100644 --- a/crates/ruff_python_formatter/src/statement/mod.rs +++ b/crates/ruff_python_formatter/src/statement/mod.rs @@ -66,6 +66,7 @@ impl FormatRule> for FormatStmt { Stmt::Break(x) => x.format().fmt(f), Stmt::Continue(x) => x.format().fmt(f), Stmt::TypeAlias(x) => x.format().fmt(f), + Stmt::LineMagic(_) => todo!(), } } }