Commit Graph
3 Commits
Author SHA1 Message Date
rajatnagda45 9ca6298761 fix(cpp): extract union specifiers as class-like type nodes
(cherry picked from commit b6c9c34359)
2026-10-04 20:23:13 +01:00
rajatnagda45 5bb8a61140 fix(cpp): extract enum / enum class specifiers and their enumerators
`enum_specifier` was missing from the C++ class_types, so an `enum` or
`enum class` produced no nodes at all: the enum type and every enumerator
vanished from the graph, even though struct/class specifiers right next to
them were extracted normally.

Add `enum_specifier` to the C++ class_types — its name and body sit on the
same `name`/`body` fields as struct_specifier (type_identifier +
enumerator_list) so the type gets a node and its body is walked — and add
`_cpp_extra_walk` to emit a node plus a `case_of` edge per `enumerator`.
Anonymous enums (`typedef enum { A, B } Flag`) carry no type name and are
skipped by the existing name guard rather than emitting a nameless node.
This is the C++ parity of Java's enum_constant (#1719), Swift, and Scala.

(cherry picked from commit 9cde6c2a7f)
2026-09-30 20:16:06 +01:00
rajarshidattapy f5743dde2b fix(cpp): keep symbols for nested C++ types and C++/CLI sources (#2876)
Nested class/struct types were dropped because the field_declaration branch returned
before walking the class_specifier in its type field. Walk it instead, so nested types
and their members are emitted with a contains edge from the enclosing type. C++/CLI
(ref class, gcnew, ^/% handles) cannot be parsed by tree-sitter-cpp at all (it produces
ERROR nodes and fabricates symbols), so normalize those tokens to plain C++ before
parsing, preserving byte length and line breaks; SCREAMING_CASE constants and attached
XOR/modulo operators are kept out of the handle rewrite.
2026-08-20 15:42:36 +01:00