Skip to content

Commit 35d4f05

Browse files
committed
Update functions_to_optimize.py
1 parent 538e8ee commit 35d4f05

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

codeflash/discovery/functions_to_optimize.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,13 @@ def visit_FunctionDef(self, node: FunctionDef) -> None:
102102
FunctionToOptimize(function_name=node.name, file_path=self.file_path, parents=self.ast_path[:])
103103
)
104104

105+
def visit_AsyncFunctionDef(self, node: AsyncFunctionDef) -> None:
106+
# Check if the async function has a return statement and add it to the list
107+
if function_has_return_statement(node) and not function_is_a_property(node):
108+
self.functions.append(
109+
FunctionToOptimize(function_name=node.name, file_path=self.file_path, parents=self.ast_path[:])
110+
)
111+
105112
def generic_visit(self, node: ast.AST) -> None:
106113
if isinstance(node, (FunctionDef, AsyncFunctionDef, ClassDef)):
107114
self.ast_path.append(FunctionParent(node.name, node.__class__.__name__))

0 commit comments

Comments
 (0)