Repository navigation
Description
C++ extraction: C++/CLI files and nested C++ types lose their symbols
graphify 0.9.47 · Python 3.12.10 · tree-sitter 0.25.2 · tree-sitter-cpp 0.23.4 · Windows
Two independent gaps in the C++ extractor, both hit by a .NET interop wrapper (a 141-method C++/CLI
class extracted 12 symbols). Happy to split into two issues.
Reproducer for both — _get_extractor(p)(p), labels shown verbatim:
1. C++/CLI is unparseable, and the failure takes the whole class body with it
// cli.h
namespace N {
public ref class Wrapper
{
public:
static void Init() { }
static System::String^ Name() { return gcnew System::String(""); }
};
}parse_errors={'first_error_line': 2, 'multiline_error': False}
labels=['cli.h', 'Wrapper()', 'public']
tree-sitter-cpp implements none of ref class, Type^, Type%, gcnew, [assembly:...]. Because the
ERROR lands on the type header, everything inside dissolves and recovery invents Wrapper() / public.
Expected: Wrapper, .Init(), .Name().
2. Nested C++ types are dropped — silently, in plain C++
// nested.h
namespace N {
class Outer
{
public:
class Inner
{
public:
static void Method() { }
};
};
}parse_errors=None
labels=['nested.h', 'Outer']
No parse error and no warning — Inner and everything in it are simply gone. Cause: a nested type is a
field_declaration whose type field is the class_specifier, and the C++ member-variable branch in
extractors/engine.py (config.ts_module == "tree_sitter_cpp" and t == "field_declaration") consumes the
node and returns before the walk can descend. The engine already supports nested classes for other
languages (is_nested_type, the contains edge).
Fix I'm running locally
Both patched against 0.9.47, giving ['cli.h', 'Wrapper', '.Init()', '.Name()', 'String'] and
['nested.h', 'Outer', 'Inner', '.Method()']:
- A
source_overrideforextract_cppthat normalizes C++/CLI to the nearest standard C++ spelling.
It is byte-length preserving (removed tokens overwritten with spaces, never deleted), so every
offset, line and column still points at the same place in the file on disk, and it only engages on
files carrying a CLI marker — plain C/C++/CUDA parses byte-for-byte as before. - In that
field_declarationbranch, descend into aclass_specifiertype field withparent_class_nid
threaded through, returning unless a member is declared alongside it (class Inner { } inst;).
On a 1475-file repo this took GmshCommon.h from 13 nodes to 116 (107 methods, 8 nested classes) with no
change elsewhere. Glad to open a PR if the approach looks right.
Unrelated, one line
--force doesn't invalidate graphify-out/cache/ast/<version>, so any extractor change is masked until
that directory is deleted by hand — worth a flag or a note.
Activity
fix(cpp): keep symbols for nested C++ types and C++/CLI sources (#2876)
docs(cpp): note nested enums stay out of scope of the nested-type fix (…
chore: bump to 0.9.48
safishamsi commentedon Aug 20, 2026
Fixed in v0.9.48: https://github.com/Graphify-Labs/graphify/releases/tag/v0.9.48 (C++ nested class/struct types and C++/CLI sources now keep their symbols). Closing as resolved.
fix(csharp): escape contextual-keyword names the grammar rejects (#5043)