MCPcopy
hub / github.com/tirth8205/code-review-graph / _extract_r_methods

Method _extract_r_methods

code_review_graph/parser.py:6918–6957  ·  view source on GitHub ↗

Extract methods from a setRefClass methods = list(...) call.

(
        self, list_call, source: bytes, language: str, file_path: str,
        nodes: list[NodeInfo], edges: list[EdgeInfo],
        class_name: str,
        import_map: Optional[dict[str, str]],
        defined_names: Optional[set[str]],
    )

Source from the content-addressed store, hash-verified

6916 return True
6917
6918 def _extract_r_methods(
6919 self, list_call, source: bytes, language: str, file_path: str,
6920 nodes: list[NodeInfo], edges: list[EdgeInfo],
6921 class_name: str,
6922 import_map: Optional[dict[str, str]],
6923 defined_names: Optional[set[str]],
6924 ) -> None:
6925 """Extract methods from a setRefClass methods = list(...) call."""
6926 for method_name, func_def in self._r_iter_args(list_call):
6927 if not method_name or func_def is None:
6928 continue
6929 if func_def.type != "function_definition":
6930 continue
6931
6932 qualified = self._qualify(method_name, file_path, class_name)
6933 params = self._get_params(func_def, language, source)
6934 nodes.append(NodeInfo(
6935 kind="Function",
6936 name=method_name,
6937 file_path=file_path,
6938 line_start=func_def.start_point[0] + 1,
6939 line_end=func_def.end_point[0] + 1,
6940 language=language,
6941 parent_name=class_name,
6942 params=params,
6943 ))
6944 edges.append(EdgeInfo(
6945 kind="CONTAINS",
6946 source=self._qualify(class_name, file_path, None),
6947 target=qualified,
6948 file_path=file_path,
6949 line=func_def.start_point[0] + 1,
6950 ))
6951 self._extract_from_tree(
6952 func_def, source, language, file_path, nodes, edges,
6953 enclosing_class=class_name,
6954 enclosing_func=method_name,
6955 import_map=import_map,
6956 defined_names=defined_names,
6957 )

Callers 1

_handle_r_class_callMethod · 0.95

Calls 6

_r_iter_argsMethod · 0.95
_qualifyMethod · 0.95
_get_paramsMethod · 0.95
_extract_from_treeMethod · 0.95
NodeInfoClass · 0.85
EdgeInfoClass · 0.85

Tested by

no test coverage detected