Files
graphify/tests/fixtures/sample.cs
T
Synvoya bb5e5192df fix(csharp): emit type references for properties
The C# class-body walker only handled field_declaration, so a
property's type produced no references(field) edge. In idiomatic C#,
auto-properties (`public Widget Main { get; set; }`) — not bare fields
— are the standard way to declare state, so this silently dropped most
of a class's type relationships.

Add a property_declaration branch alongside the field_declaration
handler, guarded the same way (ts_module == tree_sitter_c_sharp,
parent_class_nid set). A property exposes its type on the node directly
(no variable_declaration wrapper), so read it via
child_by_field_name("type") and collect refs with
_csharp_collect_type_refs, mirroring the Java/PHP/Kotlin siblings so
List<Widget> yields both the List field ref and the Widget generic_arg
ref. Only emit when target != parent_class_nid.
2026-07-01 16:36:50 +01:00

55 lines
1.1 KiB
C#

using System;
using System.Collections.Generic;
using System.Net.Http;
namespace GraphifyDemo
{
public interface IProcessor
{
List<string> Process(List<string> items);
}
public class Processor
{
}
public class Result<T>
{
}
public class DataProcessor : Processor, IProcessor
{
private readonly HttpClient _client;
public Processor Owner { get; set; }
public List<Processor> Workers { get; set; }
public DataProcessor()
{
_client = new HttpClient();
}
public List<string> Process(List<string> items)
{
return Validate(items);
}
public Result<DataProcessor> Build(HttpClient client)
{
return null;
}
private List<string> Validate(List<string> items)
{
var result = new List<string>();
foreach (var item in items)
{
if (!string.IsNullOrEmpty(item))
result.Add(item.Trim());
}
return result;
}
}
}