gitnexus 1.6.6-rc.101 → 1.6.6-rc.102

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (32) hide show
  1. package/dist/core/ingestion/export-detection.js +0 -5
  2. package/dist/core/ingestion/field-extractors/configs/dart.js +1 -4
  3. package/dist/core/ingestion/field-extractors/configs/php.js +1 -2
  4. package/dist/core/ingestion/field-extractors/configs/swift.js +1 -1
  5. package/dist/core/ingestion/field-extractors/typescript.js +0 -29
  6. package/dist/core/ingestion/languages/cpp/arity-metadata.js +2 -8
  7. package/dist/core/ingestion/languages/cpp/captures.js +1 -1
  8. package/dist/core/ingestion/languages/csharp/captures.js +3 -1
  9. package/dist/core/ingestion/languages/java/captures.js +4 -1
  10. package/dist/core/ingestion/languages/php/import-decomposer.js +2 -33
  11. package/dist/core/ingestion/languages/php/receiver-binding.js +8 -4
  12. package/dist/core/ingestion/languages/python/depends-references.js +1 -1
  13. package/dist/core/ingestion/languages/ruby/captures.js +2 -2
  14. package/dist/core/ingestion/languages/rust/range-binding.js +2 -3
  15. package/dist/core/ingestion/languages/typescript/receiver-binding.js +0 -1
  16. package/dist/core/ingestion/method-extractors/configs/dart.js +0 -1
  17. package/dist/core/ingestion/method-extractors/configs/php.js +0 -1
  18. package/dist/core/ingestion/type-env.js +0 -2
  19. package/dist/core/ingestion/type-extractors/c-cpp.js +8 -10
  20. package/dist/core/ingestion/type-extractors/csharp.js +18 -34
  21. package/dist/core/ingestion/type-extractors/go.js +2 -10
  22. package/dist/core/ingestion/type-extractors/jvm.js +6 -5
  23. package/dist/core/ingestion/type-extractors/php.js +1 -1
  24. package/dist/core/ingestion/type-extractors/python.js +1 -1
  25. package/dist/core/ingestion/type-extractors/ruby.js +2 -2
  26. package/dist/core/ingestion/type-extractors/rust.js +0 -16
  27. package/dist/core/ingestion/type-extractors/shared.d.ts +2 -2
  28. package/dist/core/ingestion/type-extractors/shared.js +25 -11
  29. package/dist/core/ingestion/type-extractors/swift.js +5 -5
  30. package/dist/core/ingestion/type-extractors/typescript.js +1 -1
  31. package/dist/core/ingestion/variable-extractors/configs/dart.js +0 -9
  32. package/package.json +1 -1
@@ -62,11 +62,6 @@ const CSHARP_DECL_TYPES = new Set([
62
62
  'struct_declaration',
63
63
  'enum_declaration',
64
64
  'record_declaration',
65
- // tree-sitter-c-sharp absorbs 'record struct' and 'record class' into
66
- // record_declaration — these two node types are listed defensively but
67
- // never emitted by the grammar in practice (verified against ^0.23.1).
68
- 'record_struct_declaration',
69
- 'record_class_declaration',
70
65
  'delegate_declaration',
71
66
  'property_declaration',
72
67
  'field_declaration',
@@ -42,10 +42,7 @@ export const dartConfig = {
42
42
  // declaration > type_identifier (first named child usually)
43
43
  for (let i = 0; i < node.namedChildCount; i++) {
44
44
  const child = node.namedChild(i);
45
- if (child &&
46
- (child.type === 'type_identifier' ||
47
- child.type === 'generic_type' ||
48
- child.type === 'function_type')) {
45
+ if (child && (child.type === 'type_identifier' || child.type === 'function_type')) {
49
46
  return extractSimpleTypeName(child) ?? child.text?.trim();
50
47
  }
51
48
  }
@@ -46,8 +46,7 @@ export const phpConfig = {
46
46
  child.type === 'named_type' ||
47
47
  child.type === 'optional_type' ||
48
48
  child.type === 'primitive_type' ||
49
- child.type === 'intersection_type' ||
50
- child.type === 'nullable_type') {
49
+ child.type === 'intersection_type') {
51
50
  return extractSimpleTypeName(child) ?? child.text?.trim();
52
51
  }
53
52
  }
@@ -17,7 +17,7 @@ const SWIFT_VIS = new Set([
17
17
  */
18
18
  export const swiftConfig = {
19
19
  language: SupportedLanguages.Swift,
20
- typeDeclarationNodes: ['class_declaration', 'struct_declaration', 'protocol_declaration'],
20
+ typeDeclarationNodes: ['class_declaration', 'protocol_declaration'],
21
21
  fieldNodeTypes: ['property_declaration'],
22
22
  bodyNodeTypes: ['class_body', 'protocol_body'],
23
23
  defaultVisibility: 'internal',
@@ -70,17 +70,6 @@ export class TypeScriptFieldExtractor extends BaseFieldExtractor {
70
70
  }
71
71
  }
72
72
  }
73
- // Check for modifier node (tree-sitter typescript may group these)
74
- const modifiers = node.childForFieldName('modifiers');
75
- if (modifiers) {
76
- for (let i = 0; i < modifiers.childCount; i++) {
77
- const modifier = modifiers.child(i);
78
- const modText = modifier?.text.trim();
79
- if (modText && TypeScriptFieldExtractor.VISIBILITY_MODIFIERS.has(modText)) {
80
- return modText;
81
- }
82
- }
83
- }
84
73
  // TypeScript class members are public by default
85
74
  return 'public';
86
75
  }
@@ -94,15 +83,6 @@ export class TypeScriptFieldExtractor extends BaseFieldExtractor {
94
83
  return true;
95
84
  }
96
85
  }
97
- const modifiers = node.childForFieldName('modifiers');
98
- if (modifiers) {
99
- for (let i = 0; i < modifiers.childCount; i++) {
100
- const modifier = modifiers.child(i);
101
- if (modifier && modifier.text === 'static') {
102
- return true;
103
- }
104
- }
105
- }
106
86
  return false;
107
87
  }
108
88
  /**
@@ -115,15 +95,6 @@ export class TypeScriptFieldExtractor extends BaseFieldExtractor {
115
95
  return true;
116
96
  }
117
97
  }
118
- const modifiers = node.childForFieldName('modifiers');
119
- if (modifiers) {
120
- for (let i = 0; i < modifiers.childCount; i++) {
121
- const modifier = modifiers.child(i);
122
- if (modifier && modifier.text === 'readonly') {
123
- return true;
124
- }
125
- }
126
- }
127
98
  return false;
128
99
  }
129
100
  /**
@@ -23,7 +23,6 @@ export function computeCppDeclarationArity(node) {
23
23
  continue;
24
24
  if (child.type === 'parameter_declaration' ||
25
25
  child.type === 'optional_parameter_declaration' ||
26
- child.type === 'variadic_parameter' ||
27
26
  child.type === 'variadic_parameter_declaration') {
28
27
  params.push(child);
29
28
  }
@@ -47,8 +46,7 @@ export function computeCppDeclarationArity(node) {
47
46
  // token in tree-sitter-cpp, detected via `hasEllipsis` above.
48
47
  // C++ parameter packs: `template<typename... Ts> void foo(Ts... args)` —
49
48
  // detected as `variadic_parameter_declaration`.
50
- const isVariadic = hasEllipsis ||
51
- params.some((p) => p.type === 'variadic_parameter' || p.type === 'variadic_parameter_declaration');
49
+ const isVariadic = hasEllipsis || params.some((p) => p.type === 'variadic_parameter_declaration');
52
50
  const optionalCount = params.filter((p) => p.type === 'optional_parameter_declaration').length;
53
51
  const requiredCount = params.filter((p) => p.type === 'parameter_declaration' ||
54
52
  // variadic_parameter_declaration with a name is a parameter pack — counts as one
@@ -57,11 +55,7 @@ export function computeCppDeclarationArity(node) {
57
55
  const types = [];
58
56
  const typeClasses = [];
59
57
  for (const p of params) {
60
- if (p.type === 'variadic_parameter') {
61
- types.push('...');
62
- typeClasses.push(unknownTypeClass('...'));
63
- }
64
- else if (p.type === 'variadic_parameter_declaration') {
58
+ if (p.type === 'variadic_parameter_declaration') {
65
59
  // Parameter pack: treated as variadic
66
60
  types.push('...');
67
61
  typeClasses.push(unknownTypeClass('...'));
@@ -1251,7 +1251,7 @@ function lookupAdlIdentifierType(identNode) {
1251
1251
  inner = next;
1252
1252
  continue;
1253
1253
  }
1254
- if (inner.type === 'reference_declarator' || inner.type === 'rvalue_reference_declarator') {
1254
+ if (inner.type === 'reference_declarator') {
1255
1255
  // reference_declarator has a single child (the inner declarator).
1256
1256
  let next = null;
1257
1257
  for (let j = 0; j < inner.namedChildCount; j++) {
@@ -242,7 +242,9 @@ function terminalTypeNameNode(node) {
242
242
  case 'qualified_name':
243
243
  return node.lastNamedChild;
244
244
  case 'generic_name':
245
- return node.childForFieldName('name') ?? node.firstNamedChild;
245
+ // generic_name has no `name` field (verified by real parse, #1920); the
246
+ // base identifier is the first named child.
247
+ return node.firstNamedChild;
246
248
  default:
247
249
  return null;
248
250
  }
@@ -132,9 +132,12 @@ export function emitJavaScopeCaptures(sourceText, _filePath, cachedTree) {
132
132
  findNodeAtRange(tree.rootNode, anchor.range, 'object_creation_expression');
133
133
  if (callNode !== null) {
134
134
  const argList = callNode.childForFieldName('arguments');
135
+ // Exclude interleaved comments — tree-sitter-java emits `block_comment` /
136
+ // `line_comment` as named children of argument_list, which would inflate
137
+ // arity (and arity feeds call-processor symbol-ID generation). #1920
135
138
  const args = argList === null
136
139
  ? []
137
- : argList.namedChildren.filter((c) => c !== null && c.type !== 'comment');
140
+ : argList.namedChildren.filter((c) => c !== null && c.type !== 'block_comment' && c.type !== 'line_comment');
138
141
  grouped['@reference.arity'] = syntheticCapture('@reference.arity', callNode, String(args.length));
139
142
  const argTypes = args.map((arg) => inferArgType(arg));
140
143
  grouped['@reference.parameter-types'] = syntheticCapture('@reference.parameter-types', callNode, JSON.stringify(argTypes));
@@ -97,23 +97,7 @@ function parseUseClause(clause, qualifier) {
97
97
  const source = qualName.text.trim();
98
98
  if (source === '')
99
99
  return null;
100
- // Strategy 1: explicit alias_clause wrapper (older grammar versions).
101
- const aliasClause = findNamedChild(clause, 'alias_clause');
102
- if (aliasClause !== null) {
103
- // alias_clause: "as" name
104
- const aliasName = findNamedChild(aliasClause, 'name') ?? aliasClause.firstNamedChild;
105
- const alias = aliasName?.text.trim() ?? '';
106
- if (alias === '')
107
- return null;
108
- return {
109
- kind: 'alias',
110
- source,
111
- name: alias,
112
- alias,
113
- atNode: clause,
114
- };
115
- }
116
- // Strategy 2: bare sibling `name` node after the qualified_name.
100
+ // Strategy: bare sibling `name` node after the qualified_name.
117
101
  // tree-sitter-php (≥ 0.22) emits `use Foo\Bar as Baz` as:
118
102
  // namespace_use_clause
119
103
  // qualified_name "Foo\Bar"
@@ -197,22 +181,7 @@ function parseInnerClause(clause, prefix, qualifier) {
197
181
  if (innerPath === '')
198
182
  return null;
199
183
  const source = prefix !== '' ? `${prefix}\\${innerPath}` : innerPath;
200
- // Strategy 1: explicit alias_clause wrapper (older grammar versions).
201
- const aliasClause = findNamedChild(clause, 'alias_clause');
202
- if (aliasClause !== null) {
203
- const aliasName = findNamedChild(aliasClause, 'name') ?? aliasClause.firstNamedChild;
204
- const alias = aliasName?.text.trim() ?? '';
205
- if (alias === '')
206
- return null;
207
- return {
208
- kind: 'alias',
209
- source,
210
- name: alias,
211
- alias,
212
- atNode: clause,
213
- };
214
- }
215
- // Strategy 2: bare sibling `name` node after the qualified_name (tree-sitter-php ≥ 0.22).
184
+ // Strategy: bare sibling `name` node after the qualified_name (tree-sitter-php ≥ 0.22).
216
185
  if (clause.namedChildCount >= 2) {
217
186
  const lastChild = clause.namedChild(clause.namedChildCount - 1);
218
187
  if (lastChild !== null && lastChild !== qualName && lastChild.type === 'name') {
@@ -24,6 +24,11 @@ const TYPE_DECL_NODE_TYPES = new Set([
24
24
  'interface_declaration',
25
25
  'trait_declaration',
26
26
  'enum_declaration',
27
+ // tree-sitter-php node for `new class {...}` (real node is `anonymous_class`,
28
+ // not `anonymous_class_declaration`). Included so the enclosing-type walk
29
+ // stops AT the anon class and the guard below skips it (otherwise a method in
30
+ // an anon class nested in a named class would mis-bind $this to the outer class).
31
+ 'anonymous_class',
27
32
  ]);
28
33
  const FUNCTION_NODE_TYPES = new Set([
29
34
  'method_declaration',
@@ -94,7 +99,7 @@ export function synthesizePhpReceiverBinding(fnNode) {
94
99
  if (enclosingType === null)
95
100
  return [];
96
101
  // Anonymous class — skip (no stable name).
97
- if (enclosingType.type === 'anonymous_class_declaration')
102
+ if (enclosingType.type === 'anonymous_class')
98
103
  return [];
99
104
  const enclosingName = typeName(enclosingType);
100
105
  if (enclosingName === null)
@@ -102,9 +107,8 @@ export function synthesizePhpReceiverBinding(fnNode) {
102
107
  // Anchor the synthesized captures to the method body (compound_statement)
103
108
  // so they land inside the function scope, not at the class scope.
104
109
  // For interface/abstract methods that have no body, skip.
105
- const bodyNode = fnNode.childForFieldName('body') ??
106
- // arrow_function: body is the expression after `=>`
107
- fnNode.childForFieldName('return_value');
110
+ // tree-sitter-php arrow_function also exposes its expression via the `body` field.
111
+ const bodyNode = fnNode.childForFieldName('body');
108
112
  if (bodyNode === null)
109
113
  return [];
110
114
  const out = [];
@@ -27,7 +27,7 @@ export function synthesizeDependsReferences(fnNode) {
27
27
  if (param.type !== 'typed_default_parameter' && param.type !== 'default_parameter') {
28
28
  continue;
29
29
  }
30
- const defaultValue = param.childForFieldName('value') ?? param.childForFieldName('default');
30
+ const defaultValue = param.childForFieldName('value');
31
31
  if (defaultValue === null)
32
32
  continue;
33
33
  const callNode = defaultValue.type === 'call' ? defaultValue : null;
@@ -148,7 +148,7 @@ export function emitRubyScopeCaptures(sourceText, _filePath, cachedTree) {
148
148
  if (argList !== null) {
149
149
  for (let ai = 0; ai < argList.namedChildCount; ai++) {
150
150
  const arg = argList.namedChild(ai);
151
- if (arg !== null && (arg.type === 'simple_symbol' || arg.type === 'symbol')) {
151
+ if (arg !== null && arg.type === 'simple_symbol') {
152
152
  const propName = arg.text.replace(/^:/, '');
153
153
  out.push({
154
154
  '@import.statement': grouped['@reference.call.free'],
@@ -265,7 +265,7 @@ export function emitRubyScopeCaptures(sourceText, _filePath, cachedTree) {
265
265
  if (argList !== null) {
266
266
  for (let ai = 0; ai < argList.namedChildCount; ai++) {
267
267
  const arg = argList.namedChild(ai);
268
- if (arg !== null && (arg.type === 'simple_symbol' || arg.type === 'symbol')) {
268
+ if (arg !== null && arg.type === 'simple_symbol') {
269
269
  const propName = arg.text.replace(/^:/, '');
270
270
  out.push({
271
271
  '@type-binding.return': syntheticCapture('@type-binding.return', attrNode, text),
@@ -233,11 +233,10 @@ function processStructDestructuring(root, parsed, scopeMap, moduleScope, allFiel
233
233
  for (const fieldNode of patternNode.namedChildren) {
234
234
  let fieldName;
235
235
  if (fieldNode.type === 'field_pattern') {
236
+ // shorthand `{ a }` and full `{ b: c }` are both field_pattern; the
237
+ // `name` field is shorthand_field_identifier or field_identifier.
236
238
  fieldName = fieldNode.childForFieldName('name')?.text;
237
239
  }
238
- else if (fieldNode.type === 'shorthand_field_pattern') {
239
- fieldName = fieldNode.firstNamedChild?.text;
240
- }
241
240
  if (fieldName === undefined)
242
241
  continue;
243
242
  let fieldType = lookupFieldType(typeName, fieldName, parsed, scopeMap, moduleScope);
@@ -49,7 +49,6 @@ const TYPE_DECL_NODE_TYPES = new Set([
49
49
  'class_declaration',
50
50
  'abstract_class_declaration',
51
51
  'class',
52
- 'class_expression',
53
52
  'interface_declaration',
54
53
  ]);
55
54
  /** Scope function nodes that could be a class method body. */
@@ -8,7 +8,6 @@ import { extractSimpleTypeName } from '../../type-extractors/shared.js';
8
8
  /** Type node types that represent a return type in function/getter/setter signatures. */
9
9
  const TYPE_NODE_TYPES = new Set([
10
10
  'type_identifier',
11
- 'generic_type',
12
11
  'function_type',
13
12
  'nullable_type',
14
13
  'void_type',
@@ -101,7 +101,6 @@ function extractPhpReturnType(node) {
101
101
  'named_type',
102
102
  'union_type',
103
103
  'optional_type',
104
- 'nullable_type',
105
104
  'intersection_type',
106
105
  ]);
107
106
  let astType;
@@ -35,7 +35,6 @@ const findTypeIdentifierChild = (node) => {
35
35
  * Includes both multi-arm pattern-match branches AND if-statement bodies for null-check narrowing. */
36
36
  const NARROWING_BRANCH_TYPES = new Set([
37
37
  'when_entry', // Kotlin when
38
- 'switch_block_label', // Java switch (enhanced)
39
38
  'if_statement', // TS/JS, Java, C/C++
40
39
  'if_expression', // Kotlin (if is an expression)
41
40
  'statement_block', // TS/JS: { ... } body of if
@@ -796,7 +795,6 @@ export const buildTypeEnv = (tree, language, options) => {
796
795
  (child.type === 'user_type' ||
797
796
  child.type === 'type_identifier' ||
798
797
  child.type === 'generic_type' ||
799
- child.type === 'parameterized_type' ||
800
798
  child.type === 'nullable_type')) {
801
799
  fallbackType = child;
802
800
  }
@@ -111,13 +111,13 @@ const extractInitializer = (node, env, classNames) => {
111
111
  // or: call_expression > function: template_function (unqualified)
112
112
  const templateFunc = func.type === 'template_function'
113
113
  ? func
114
- : func.type === 'qualified_identifier' || func.type === 'scoped_identifier'
114
+ : func.type === 'qualified_identifier'
115
115
  ? (func.namedChildren.find((c) => c.type === 'template_function') ?? null)
116
116
  : null;
117
117
  if (templateFunc) {
118
118
  const nameNode = templateFunc.firstNamedChild;
119
119
  if (nameNode) {
120
- const funcName = nameNode.type === 'qualified_identifier' || nameNode.type === 'scoped_identifier'
120
+ const funcName = nameNode.type === 'qualified_identifier'
121
121
  ? (nameNode.lastNamedChild?.text ?? '')
122
122
  : nameNode.text;
123
123
  if (SMART_PTR_FACTORIES.has(funcName)) {
@@ -185,7 +185,7 @@ const scanConstructorBinding = (node) => {
185
185
  const func = value.childForFieldName('function');
186
186
  if (!func)
187
187
  return undefined;
188
- if (func.type === 'qualified_identifier' || func.type === 'scoped_identifier') {
188
+ if (func.type === 'qualified_identifier') {
189
189
  const last = func.lastNamedChild;
190
190
  if (!last)
191
191
  return undefined;
@@ -309,16 +309,14 @@ const extractCppElementTypeFromTypeNode = (typeNode, pos = 'last', depth = 0) =>
309
309
  if (args.length >= 1)
310
310
  return pos === 'first' ? args[0] : args[args.length - 1];
311
311
  }
312
- // reference/pointer types: unwrap and recurse (vector<User>& → vector<User>)
313
- if (typeNode.type === 'reference_type' ||
314
- typeNode.type === 'pointer_type' ||
315
- typeNode.type === 'type_descriptor') {
312
+ // type_descriptor wrapper: unwrap and recurse (vector<User>& → vector<User>)
313
+ if (typeNode.type === 'type_descriptor') {
316
314
  const inner = typeNode.lastNamedChild;
317
315
  if (inner)
318
316
  return extractCppElementTypeFromTypeNode(inner, pos, depth + 1);
319
317
  }
320
- // qualified/scoped types: std::vector<User> → unwrap to template_type child
321
- if (typeNode.type === 'qualified_identifier' || typeNode.type === 'scoped_type_identifier') {
318
+ // qualified types: std::vector<User> → unwrap to template_type child
319
+ if (typeNode.type === 'qualified_identifier') {
322
320
  const inner = typeNode.lastNamedChild;
323
321
  if (inner)
324
322
  return extractCppElementTypeFromTypeNode(inner, pos, depth + 1);
@@ -497,7 +495,7 @@ const detectCppConstructorType = (node, classNames) => {
497
495
  if (!nameNode)
498
496
  return undefined;
499
497
  let funcName;
500
- if (nameNode.type === 'qualified_identifier' || nameNode.type === 'scoped_identifier') {
498
+ if (nameNode.type === 'qualified_identifier') {
501
499
  funcName = nameNode.lastNamedChild?.text ?? '';
502
500
  }
503
501
  else {
@@ -27,7 +27,7 @@ const extractDeclaration = (node, env) => {
27
27
  const child = node.namedChild(i);
28
28
  if (!child)
29
29
  continue;
30
- if (!typeNode && child.type !== 'variable_declarator' && child.type !== 'equals_value_clause') {
30
+ if (!typeNode && child.type !== 'variable_declarator') {
31
31
  // First non-declarator child is the type (identifier, implicit_type, generic_name, etc.)
32
32
  typeNode = child;
33
33
  }
@@ -41,11 +41,9 @@ const extractDeclaration = (node, env) => {
41
41
  let typeName;
42
42
  if (typeNode.type === 'implicit_type' && typeNode.text === 'var') {
43
43
  // Try to infer from initializer: var x = new Foo()
44
- // tree-sitter-c-sharp may put object_creation_expression as direct child
45
- // or inside equals_value_clause depending on grammar version
44
+ // tree-sitter-c-sharp puts object_creation_expression as a direct child
46
45
  if (declarators.length === 1) {
47
- const initializer = findChild(declarators[0], 'object_creation_expression') ??
48
- findChild(declarators[0], 'equals_value_clause')?.firstNamedChild;
46
+ const initializer = findChild(declarators[0], 'object_creation_expression');
49
47
  if (initializer?.type === 'object_creation_expression') {
50
48
  const ctorType = initializer.childForFieldName('type');
51
49
  if (ctorType)
@@ -76,7 +74,7 @@ const extractParameter = (node, env) => {
76
74
  nameNode = node.childForFieldName('name');
77
75
  }
78
76
  else {
79
- nameNode = node.childForFieldName('name') ?? node.childForFieldName('pattern');
77
+ nameNode = node.childForFieldName('name');
80
78
  typeNode = node.childForFieldName('type');
81
79
  }
82
80
  if (!nameNode || !typeNode)
@@ -113,17 +111,13 @@ const scanConstructorBinding = (node) => {
113
111
  const nameNode = declarator.childForFieldName('name') ?? declarator.firstNamedChild;
114
112
  if (!nameNode || nameNode.type !== 'identifier')
115
113
  return undefined;
116
- // Find the initializer value: either inside equals_value_clause or as a direct child
114
+ // Find the initializer value as a direct child
117
115
  // (tree-sitter-c-sharp puts invocation_expression directly inside variable_declarator)
118
116
  let value = null;
119
117
  for (let i = 0; i < declarator.namedChildCount; i++) {
120
118
  const child = declarator.namedChild(i);
121
119
  if (!child)
122
120
  continue;
123
- if (child.type === 'equals_value_clause') {
124
- value = child.firstNamedChild;
125
- break;
126
- }
127
121
  if (child.type === 'invocation_expression' ||
128
122
  child.type === 'object_creation_expression' ||
129
123
  child.type === 'await_expression') {
@@ -462,18 +456,9 @@ const extractPendingAssignment = (node, scopeEnv) => {
462
456
  const lhs = nameNode.text;
463
457
  if (scopeEnv.has(lhs))
464
458
  continue;
465
- // C# wraps value in equals_value_clause; fall back to last named child
466
- let evc = null;
467
- for (let j = 0; j < child.childCount; j++) {
468
- if (child.child(j)?.type === 'equals_value_clause') {
469
- evc = child.child(j);
470
- break;
471
- }
472
- }
473
- const valueNode = evc?.firstNamedChild ?? child.namedChild(child.namedChildCount - 1);
474
- if (valueNode &&
475
- valueNode !== nameNode &&
476
- (valueNode.type === 'identifier' || valueNode.type === 'simple_identifier')) {
459
+ // C# variable_declarator holds the initializer value as a direct named child
460
+ const valueNode = child.namedChild(child.namedChildCount - 1);
461
+ if (valueNode && valueNode !== nameNode && valueNode.type === 'identifier') {
477
462
  return { kind: 'copy', lhs, rhs: valueNode.text };
478
463
  }
479
464
  // member_access_expression RHS → fieldAccess (a.Field)
@@ -487,7 +472,7 @@ const extractPendingAssignment = (node, scopeEnv) => {
487
472
  // invocation_expression RHS
488
473
  if (valueNode?.type === 'invocation_expression') {
489
474
  const funcNode = valueNode.firstNamedChild;
490
- if (funcNode?.type === 'identifier_name' || funcNode?.type === 'identifier') {
475
+ if (funcNode?.type === 'identifier') {
491
476
  return { kind: 'callResult', lhs, callee: funcNode.text };
492
477
  }
493
478
  // method call with receiver → methodCallResult: a.GetC()
@@ -504,7 +489,7 @@ const extractPendingAssignment = (node, scopeEnv) => {
504
489
  const inner = valueNode.firstNamedChild;
505
490
  if (inner?.type === 'invocation_expression') {
506
491
  const funcNode = inner.firstNamedChild;
507
- if (funcNode?.type === 'identifier_name' || funcNode?.type === 'identifier') {
492
+ if (funcNode?.type === 'identifier') {
508
493
  return { kind: 'callResult', lhs, callee: funcNode.text };
509
494
  }
510
495
  if (funcNode?.type === 'member_access_expression') {
@@ -555,15 +540,14 @@ export const typeConfig = {
555
540
  const direct = node.childForFieldName('type');
556
541
  if (direct)
557
542
  return direct;
558
- const wrapped = node.childForFieldName('declaration') ??
559
- (() => {
560
- for (let i = 0; i < node.namedChildCount; i++) {
561
- const c = node.namedChild(i);
562
- if (c?.type === 'variable_declaration')
563
- return c;
564
- }
565
- return null;
566
- })();
543
+ const wrapped = (() => {
544
+ for (let i = 0; i < node.namedChildCount; i++) {
545
+ const c = node.namedChild(i);
546
+ if (c?.type === 'variable_declaration')
547
+ return c;
548
+ }
549
+ return null;
550
+ })();
567
551
  return wrapped?.childForFieldName('type') ?? null;
568
552
  },
569
553
  forLoopNodeTypes: FOR_LOOP_NODE_TYPES,
@@ -131,16 +131,8 @@ const extractDeclaration = (node, env) => {
131
131
  };
132
132
  /** Go: parameter → name type */
133
133
  const extractParameter = (node, env) => {
134
- let nameNode = null;
135
- let typeNode = null;
136
- if (node.type === 'parameter') {
137
- nameNode = node.childForFieldName('name');
138
- typeNode = node.childForFieldName('type');
139
- }
140
- else {
141
- nameNode = node.childForFieldName('name') ?? node.childForFieldName('pattern');
142
- typeNode = node.childForFieldName('type');
143
- }
134
+ const nameNode = node.childForFieldName('name');
135
+ const typeNode = node.childForFieldName('type');
144
136
  if (!nameNode || !typeNode)
145
137
  return;
146
138
  const varName = extractVarName(nameNode);
@@ -60,7 +60,7 @@ const extractJavaParameter = (node, env) => {
60
60
  }
61
61
  else {
62
62
  // Generic fallback
63
- nameNode = node.childForFieldName('name') ?? node.childForFieldName('pattern');
63
+ nameNode = node.childForFieldName('name');
64
64
  typeNode = node.childForFieldName('type');
65
65
  }
66
66
  if (!nameNode || !typeNode)
@@ -359,9 +359,10 @@ const extractKotlinDeclaration = (node, env) => {
359
359
  env.set(varName, typeName);
360
360
  return;
361
361
  }
362
- // Fallback: try direct fields
363
- const nameNode = node.childForFieldName('name') ?? findChild(node, 'simple_identifier');
364
- const typeNode = node.childForFieldName('type') ?? findChild(node, 'user_type');
362
+ // Fallback: Kotlin property_declaration has no name/type fields (verified by
363
+ // real parse, #1920); the name/type are positional children.
364
+ const nameNode = findChild(node, 'simple_identifier');
365
+ const typeNode = findChild(node, 'user_type');
365
366
  if (!nameNode || !typeNode)
366
367
  return;
367
368
  const varName = extractVarName(nameNode);
@@ -393,7 +394,7 @@ const extractKotlinParameter = (node, env) => {
393
394
  nameNode = node.childForFieldName('name');
394
395
  }
395
396
  else {
396
- nameNode = node.childForFieldName('name') ?? node.childForFieldName('pattern');
397
+ nameNode = node.childForFieldName('name');
397
398
  typeNode = node.childForFieldName('type');
398
399
  }
399
400
  // Fallback: Kotlin `parameter` nodes use positional children, not named fields
@@ -269,7 +269,7 @@ const extractParameter = (node, env) => {
269
269
  nameNode = node.childForFieldName('name');
270
270
  }
271
271
  else {
272
- nameNode = node.childForFieldName('name') ?? node.childForFieldName('pattern');
272
+ nameNode = node.childForFieldName('name');
273
273
  typeNode = node.childForFieldName('type');
274
274
  }
275
275
  if (!nameNode || !typeNode)
@@ -59,7 +59,7 @@ const extractParameter = (node, env) => {
59
59
  typeNode = node.childForFieldName('type');
60
60
  }
61
61
  else {
62
- nameNode = node.childForFieldName('name') ?? node.childForFieldName('pattern');
62
+ nameNode = node.childForFieldName('name');
63
63
  typeNode = node.childForFieldName('type');
64
64
  // Python typed_parameter: name is a positional child (identifier), not a named field
65
65
  if (!nameNode && node.type === 'typed_parameter') {
@@ -345,8 +345,8 @@ const extractPendingAssignment = (node, scopeEnv) => {
345
345
  return undefined;
346
346
  if (rhsNode.type === 'identifier')
347
347
  return { kind: 'copy', lhs: varName, rhs: rhsNode.text };
348
- // call/method_call RHS — Ruby uses method calls for both field access and method calls
349
- if (rhsNode.type === 'call' || rhsNode.type === 'method_call') {
348
+ // call RHS — Ruby uses method calls for both field access and method calls
349
+ if (rhsNode.type === 'call') {
350
350
  const methodNode = rhsNode.childForFieldName('method');
351
351
  const receiverNode = rhsNode.childForFieldName('receiver');
352
352
  if (!receiverNode && methodNode?.type === 'identifier') {
@@ -266,16 +266,6 @@ const extractPendingAssignment = (node, scopeEnv) => {
266
266
  return { kind: 'callResult', lhs, callee: funcNode.text };
267
267
  }
268
268
  }
269
- // method_call_expression RHS → methodCallResult (receiver.method())
270
- if (unwrapped.type === 'method_call_expression') {
271
- const obj = unwrapped.firstNamedChild;
272
- if (obj?.type === 'identifier') {
273
- const methodNode = unwrapped.childForFieldName('name') ?? unwrapped.namedChild(1);
274
- if (methodNode?.type === 'field_identifier') {
275
- return { kind: 'methodCallResult', lhs, receiver: obj.text, method: methodNode.text };
276
- }
277
- }
278
- }
279
269
  return undefined;
280
270
  };
281
271
  /**
@@ -395,12 +385,6 @@ const extractRustElementTypeFromTypeNode = (typeNode, pos = 'last', depth = 0) =
395
385
  if (elemNode)
396
386
  return extractSimpleTypeName(elemNode);
397
387
  }
398
- // slice_type: [User] — element is the first child
399
- if (typeNode.type === 'slice_type') {
400
- const elemNode = typeNode.firstNamedChild;
401
- if (elemNode)
402
- return extractSimpleTypeName(elemNode);
403
- }
404
388
  return undefined;
405
389
  };
406
390
  /** Walk up from a for-loop to the enclosing function_item and search parameters
@@ -65,8 +65,8 @@ export declare const TYPED_PARAMETER_TYPES: Set<string>;
65
65
  * Note: Go slices/maps use slice_type/map_type, not generic_type — those are
66
66
  * NOT handled here. Use language-specific extractors for Go container types.
67
67
  *
68
- * @param typeNode A generic_type or parameterized_type AST node (or any node —
69
- * returns [] for non-generic types).
68
+ * @param typeNode A generic_type / generic_name / user_type AST node (or any
69
+ * node — returns [] for non-generic types).
70
70
  * @returns Array of resolved type argument names. Unresolvable arguments are omitted.
71
71
  */
72
72
  export declare const extractGenericTypeArgs: (typeNode: SyntaxNode, depth?: number) => string[];
@@ -204,9 +204,7 @@ export const extractSimpleTypeName = (typeNode, depth = 0) => {
204
204
  }
205
205
  // Generic types: extract the base type (e.g., List<User> → List)
206
206
  // For nullable wrappers (Optional<User>, Option<User>), unwrap to inner type.
207
- if (typeNode.type === 'generic_type' ||
208
- typeNode.type === 'parameterized_type' ||
209
- typeNode.type === 'generic_name') {
207
+ if (typeNode.type === 'generic_type' || typeNode.type === 'generic_name') {
210
208
  const base = typeNode.childForFieldName('name') ??
211
209
  typeNode.childForFieldName('type') ??
212
210
  typeNode.firstNamedChild;
@@ -348,17 +346,20 @@ export const TYPED_PARAMETER_TYPES = new Set([
348
346
  * Note: Go slices/maps use slice_type/map_type, not generic_type — those are
349
347
  * NOT handled here. Use language-specific extractors for Go container types.
350
348
  *
351
- * @param typeNode A generic_type or parameterized_type AST node (or any node —
352
- * returns [] for non-generic types).
349
+ * @param typeNode A generic_type / generic_name / user_type AST node (or any
350
+ * node — returns [] for non-generic types).
353
351
  * @returns Array of resolved type argument names. Unresolvable arguments are omitted.
354
352
  */
355
353
  export const extractGenericTypeArgs = (typeNode, depth = 0) => {
356
354
  if (depth > 50)
357
355
  return [];
358
- // Unwrap wrapper nodes that may sit above the generic_type
356
+ // Unwrap pure wrapper nodes (which carry no type_arguments of their own) that
357
+ // may sit above the generic type. `user_type` is intentionally NOT unwrapped
358
+ // here: a Kotlin `user_type` can itself carry a `type_arguments` child
359
+ // (`List<User>` → user_type > [type_identifier, type_arguments]), so it is
360
+ // handled as a generic-bearing node below.
359
361
  if (typeNode.type === 'type_annotation' ||
360
362
  typeNode.type === 'type' ||
361
- typeNode.type === 'user_type' ||
362
363
  typeNode.type === 'nullable_type' ||
363
364
  typeNode.type === 'optional_type') {
364
365
  const inner = typeNode.firstNamedChild;
@@ -366,10 +367,14 @@ export const extractGenericTypeArgs = (typeNode, depth = 0) => {
366
367
  return extractGenericTypeArgs(inner, depth + 1);
367
368
  return [];
368
369
  }
369
- // Only process generic/parameterized type nodes (includes C#'s generic_name)
370
+ // Generic-bearing nodes hold their arguments in a `type_arguments` /
371
+ // `type_argument_list` child: generic_type (Java/TypeScript/Rust/Go),
372
+ // generic_name (C#), and Kotlin's user_type. Verified against the installed
373
+ // grammars by real parse (#1920). A user_type without its own type_arguments
374
+ // is unwrapped at the argsNode guard below.
370
375
  if (typeNode.type !== 'generic_type' &&
371
- typeNode.type !== 'parameterized_type' &&
372
- typeNode.type !== 'generic_name') {
376
+ typeNode.type !== 'generic_name' &&
377
+ typeNode.type !== 'user_type') {
373
378
  return [];
374
379
  }
375
380
  // Find the type_arguments / type_argument_list child
@@ -381,8 +386,17 @@ export const extractGenericTypeArgs = (typeNode, depth = 0) => {
381
386
  break;
382
387
  }
383
388
  }
384
- if (!argsNode)
389
+ if (!argsNode) {
390
+ // A `user_type` without its own type_arguments wraps an inner type node
391
+ // (e.g. user_type > generic_type, or a plain user_type > type_identifier with
392
+ // no generics) — recurse into that child. generic_type / generic_name with no
393
+ // args simply have no type arguments to report.
394
+ if (typeNode.type === 'user_type') {
395
+ const inner = typeNode.firstNamedChild;
396
+ return inner ? extractGenericTypeArgs(inner, depth + 1) : [];
397
+ }
385
398
  return [];
399
+ }
386
400
  const result = [];
387
401
  for (let i = 0; i < argsNode.namedChildCount; i++) {
388
402
  let argNode = argsNode.namedChild(i);
@@ -27,7 +27,7 @@ function swiftNavigationSuffixName(node) {
27
27
  /** Swift: let x: Foo = ... */
28
28
  const extractDeclaration = (node, env) => {
29
29
  // Swift property_declaration has pattern and type_annotation
30
- const pattern = node.childForFieldName('pattern') ?? findChild(node, 'pattern');
30
+ const pattern = findChild(node, 'pattern');
31
31
  const typeAnnotation = node.childForFieldName('type') ?? findChild(node, 'type_annotation');
32
32
  if (!pattern || !typeAnnotation)
33
33
  return;
@@ -41,11 +41,11 @@ const extractParameter = (node, env) => {
41
41
  let nameNode = null;
42
42
  let typeNode = null;
43
43
  if (node.type === 'parameter') {
44
- nameNode = node.childForFieldName('name') ?? node.childForFieldName('internal_name');
44
+ nameNode = node.childForFieldName('name');
45
45
  typeNode = node.childForFieldName('type');
46
46
  }
47
47
  else {
48
- nameNode = node.childForFieldName('name') ?? node.childForFieldName('pattern');
48
+ nameNode = node.childForFieldName('name');
49
49
  typeNode = node.childForFieldName('type');
50
50
  }
51
51
  if (!nameNode || !typeNode)
@@ -65,7 +65,7 @@ const extractInitializer = (node, env, classNames) => {
65
65
  if (node.childForFieldName('type') || findChild(node, 'type_annotation'))
66
66
  return;
67
67
  // Find pattern (variable name)
68
- const pattern = node.childForFieldName('pattern') ?? findChild(node, 'pattern');
68
+ const pattern = findChild(node, 'pattern');
69
69
  if (!pattern)
70
70
  return;
71
71
  const varName = extractVarName(pattern) ?? pattern.text;
@@ -117,7 +117,7 @@ const scanConstructorBinding = (node) => {
117
117
  return undefined;
118
118
  if (hasTypeAnnotation(node))
119
119
  return undefined;
120
- const pattern = node.childForFieldName('pattern') ?? findChild(node, 'pattern');
120
+ const pattern = findChild(node, 'pattern');
121
121
  if (!pattern)
122
122
  return undefined;
123
123
  const varName = pattern.text;
@@ -269,7 +269,7 @@ const findTsIterableElementType = (iterableName, startNode, pos = 'last') => {
269
269
  while (current) {
270
270
  if (TS_FUNCTION_NODE_TYPES.has(current.type)) {
271
271
  // Search function parameters
272
- const paramsNode = current.childForFieldName('parameters') ?? current.childForFieldName('formal_parameters');
272
+ const paramsNode = current.childForFieldName('parameters');
273
273
  if (paramsNode) {
274
274
  for (let i = 0; i < paramsNode.namedChildCount; i++) {
275
275
  const param = paramsNode.namedChild(i);
@@ -1,6 +1,5 @@
1
1
  // gitnexus/src/core/ingestion/variable-extractors/configs/dart.ts
2
2
  import { SupportedLanguages } from '../../../../_shared/index.js';
3
- import { extractSimpleTypeName } from '../../type-extractors/shared.js';
4
3
  /**
5
4
  * Dart variable extraction config.
6
5
  *
@@ -43,14 +42,6 @@ function extractDartVarName(node) {
43
42
  return undefined;
44
43
  }
45
44
  function extractDartVarType(node) {
46
- for (let i = 0; i < node.namedChildCount; i++) {
47
- const child = node.namedChild(i);
48
- if (child?.type === 'initialized_variable_definition') {
49
- const typeNode = child.childForFieldName('type');
50
- if (typeNode)
51
- return extractSimpleTypeName(typeNode) ?? typeNode.text?.trim();
52
- }
53
- }
54
45
  // Look for type_identifier directly on the node
55
46
  for (let i = 0; i < node.namedChildCount; i++) {
56
47
  const child = node.namedChild(i);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gitnexus",
3
- "version": "1.6.6-rc.101",
3
+ "version": "1.6.6-rc.102",
4
4
  "description": "Graph-powered code intelligence for AI agents. Index any codebase, query via MCP or CLI.",
5
5
  "author": "Abhigyan Patwari",
6
6
  "license": "PolyForm-Noncommercial-1.0.0",