Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion codeflash/languages/java/context.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@
if TYPE_CHECKING:
from tree_sitter import Node

_PARENT_TYPE_NAMES = frozenset(("ClassDef", "InterfaceDef", "EnumDef"))

logger = logging.getLogger(__name__)


Expand Down Expand Up @@ -137,7 +139,7 @@ def _get_parent_type_name(function: FunctionInfo) -> str | None:
# Check parents for interface/enum
if function.parents:
for parent in function.parents:
if parent.type in ("ClassDef", "InterfaceDef", "EnumDef"):
if parent.type in _PARENT_TYPE_NAMES:
return parent.name

return None
Expand Down
Loading