Skip to content

Commit e9c9ed8

Browse files
committed
only push Class scope for body
1 parent ff273ba commit e9c9ed8

File tree

1 file changed

+17
-2
lines changed

1 file changed

+17
-2
lines changed

crates/ruff_python_parser/tests/fixtures.rs

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -593,9 +593,24 @@ impl Visitor<'_> for SemanticSyntaxCheckerVisitor<'_> {
593593
fn visit_stmt(&mut self, stmt: &ast::Stmt) {
594594
self.with_semantic_checker(|semantic, context| semantic.visit_stmt(stmt, context));
595595
match stmt {
596-
ast::Stmt::ClassDef(_) => {
596+
ast::Stmt::ClassDef(ast::StmtClassDef {
597+
arguments,
598+
body,
599+
decorator_list,
600+
type_params,
601+
..
602+
}) => {
603+
for decorator in decorator_list {
604+
self.visit_decorator(decorator);
605+
}
606+
if let Some(type_params) = type_params {
607+
self.visit_type_params(type_params);
608+
}
609+
if let Some(arguments) = arguments {
610+
self.visit_arguments(arguments);
611+
}
597612
self.scopes.push(Scope::Class);
598-
ast::visitor::walk_stmt(self, stmt);
613+
self.visit_body(body);
599614
self.scopes.pop().unwrap();
600615
}
601616
ast::Stmt::FunctionDef(ast::StmtFunctionDef { is_async, .. }) => {

0 commit comments

Comments
 (0)