MCPcopy Create free account
hub / github.com/Graphify-Labs/graphify / _cpp_declarator_name

Function _cpp_declarator_name

graphify/extractors/engine.py:5141–5159  ·  view source on GitHub ↗

Return the bare variable name from a C++ declaration declarator, unwrapping pointer/reference/init wrappers (``*f``, ``&r``, ``f = Foo()``). Returns None for anything that isn't a plain named local (arrays, function pointers, structured bindings) so the type table never records a guessed

(node, source: bytes)

Source from the content-addressed store, hash-verified

5139 return None
5140
5141def _cpp_declarator_name(node, source: bytes) -> str | None:
5142 """Return the bare variable name from a C++ declaration declarator, unwrapping
5143 pointer/reference/init wrappers (``*f``, ``&r``, ``f = Foo()``). Returns None
5144 for anything that isn't a plain named local (arrays, function pointers,
5145 structured bindings) so the type table never records a guessed receiver."""
5146 t = node.type
5147 if t in ("identifier", "field_identifier"):
5148 return _read_text(node, source)
5149 if t in ("pointer_declarator", "reference_declarator", "init_declarator"):
5150 inner = node.child_by_field_name("declarator")
5151 if inner is None:
5152 for c in node.children:
5153 if c.type in ("identifier", "field_identifier",
5154 "pointer_declarator", "reference_declarator"):
5155 inner = c
5156 break
5157 if inner is not None:
5158 return _cpp_declarator_name(inner, source)
5159 return None
5160
5161def _cpp_parameter_types(body_node, source: bytes, table: dict[str, str]) -> None:
5162 """Collect ``param -> ClassName`` from the enclosing function's parameter

Callers 7

_objc_local_var_typesFunction · 0.90
_field_decl_entryFunction · 0.90
_cpp_parameter_typesFunction · 0.85
_cpp_field_typesFunction · 0.85
_cpp_class_fieldsFunction · 0.85
_cpp_local_var_typesFunction · 0.85

Calls 1

_read_textFunction · 0.90

Tested by

no test coverage detected