feat(csharp): emit a member node per property (#3006)

C# properties got no graph node, so a property was invisible as a class member (only
fields and methods appeared). Emit a member node per property_declaration with the same id
scheme, ownership, and defines/field-context edge as the C++ data-member branch; all
property shapes (auto, expression-bodied, read-only) are covered, the #2913 property-type
references walk is preserved, and no builtin types are fabricated.
This commit is contained in:
durmazoguzhan authored and safishamsi committed 2026-08-24 14:08:25 +01:00
1 parent da8ca1684c
commit 3ef625b3b6
2 files changed
+173

No files matched your search

+16
View File
@@ -3750,6 +3750,22 @@ def _extract_generic(
# field. Use _csharp_collect_type_refs (like the Java/PHP/Kotlin
# siblings) so `List<Widget>` yields both the List field ref and the
# Widget generic_arg ref.
# A property becomes a node, the way a C++ data member does. Fields
# stay out: the id recipe casefolds and strips leading underscores, so
# `_count` and `Count` normalize to the same id, and emitting both
# would hand the node to whichever the parser reached first — in
# practice the private backing field, hiding the public member behind
# it. See #3006 for the follow-up.
prop_node_name = node.child_by_field_name("name")
if prop_node_name is not None:
property_name = _read_text(prop_node_name, source)
if property_name:
property_line = node.start_point[0] + 1
property_nid = _make_id(parent_class_nid, property_name)
if property_nid not in seen_ids:
add_node(property_nid, property_name, property_line)
add_edge(parent_class_nid, property_nid, "defines",
property_line, context="field")
type_node = node.child_by_field_name("type")
if type_node is not None:
# Record the property's declared type for the method-scoped