@@ -33,8 +33,10 @@ def __init__(
3333 def visit_ClassDef (self , node : ast .ClassDef ) -> ast .ClassDef :
3434 self .context_stack .append (node .name )
3535 for inner_node in node .body :
36- if isinstance (inner_node , ( ast .FunctionDef , ast . AsyncFunctionDef ) ):
36+ if isinstance (inner_node , ast .FunctionDef ):
3737 self .visit_FunctionDef (inner_node )
38+ elif isinstance (inner_node , ast .AsyncFunctionDef ):
39+ self .visit_AsyncFunctionDef (inner_node )
3840 self .context_stack .pop ()
3941 return node
4042
@@ -50,14 +52,14 @@ def get_comment(self, match_key: str) -> str:
5052 return f"# { format_time (original_time )} -> { format_time (optimized_time )} ({ perf_gain } % { status } )"
5153
5254 def visit_FunctionDef (self , node : ast .FunctionDef ) -> ast .FunctionDef :
53- return self ._process_function_def (node )
55+ self ._process_function_def_common (node )
56+ return node
5457
5558 def visit_AsyncFunctionDef (self , node : ast .AsyncFunctionDef ) -> ast .AsyncFunctionDef :
56- return self ._process_function_def (node )
59+ self ._process_function_def_common (node )
60+ return node
5761
58- def _process_function_def (
59- self , node : ast .FunctionDef | ast .AsyncFunctionDef
60- ) -> ast .FunctionDef | ast .AsyncFunctionDef :
62+ def _process_function_def_common (self , node : ast .FunctionDef | ast .AsyncFunctionDef ) -> None :
6163 self .context_stack .append (node .name )
6264 i = len (node .body ) - 1
6365 test_qualified_name = "." .join (self .context_stack )
@@ -83,7 +85,6 @@ def _process_function_def(
8385 self .results [line_node .lineno ] = self .get_comment (match_key )
8486 i -= 1
8587 self .context_stack .pop ()
86- return node
8788
8889
8990def get_fn_call_linenos (
0 commit comments