|
23 | 23 | from codeflash.languages.java.parser import get_java_analyzer |
24 | 24 |
|
25 | 25 | if TYPE_CHECKING: |
| 26 | + from tree_sitter import Node |
| 27 | + |
26 | 28 | from codeflash.discovery.functions_to_optimize import FunctionToOptimize |
27 | 29 | from codeflash.languages.java.parser import JavaAnalyzer |
28 | 30 |
|
@@ -548,7 +550,7 @@ def _extract_target_calls(self, content: str, base_offset: int) -> list[TargetCa |
548 | 550 |
|
549 | 551 | def _collect_target_invocations( |
550 | 552 | self, |
551 | | - node, |
| 553 | + node: Node, |
552 | 554 | wrapper_bytes: bytes, |
553 | 555 | content_bytes: bytes, |
554 | 556 | base_offset: int, |
@@ -601,7 +603,7 @@ def _collect_target_invocations( |
601 | 603 | self._collect_target_invocations(child, wrapper_bytes, content_bytes, base_offset, out, seen_top_level) |
602 | 604 |
|
603 | 605 | def _build_target_call( |
604 | | - self, node, wrapper_bytes: bytes, content_bytes: bytes, start_byte: int, end_byte: int, base_offset: int |
| 606 | + self, node: Node, wrapper_bytes: bytes, content_bytes: bytes, start_byte: int, end_byte: int, base_offset: int |
605 | 607 | ) -> TargetCall: |
606 | 608 | """Build a TargetCall from a tree-sitter method_invocation node.""" |
607 | 609 | object_node = node.child_by_field_name("object") |
@@ -634,7 +636,7 @@ def _build_target_call( |
634 | 636 | end_pos=base_offset + end_char, |
635 | 637 | ) |
636 | 638 |
|
637 | | - def _find_top_level_arg_node(self, target_node, wrapper_bytes: bytes): |
| 639 | + def _find_top_level_arg_node(self, target_node: Node, wrapper_bytes: bytes) -> Node | None: |
638 | 640 | """Find the top-level argument expression containing a nested target call. |
639 | 641 |
|
640 | 642 | Walks up the AST from target_node to the wrapper _d() call's argument_list. |
|
0 commit comments