gitnexus 1.6.10-rc.74 → 1.6.10-rc.76

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.
@@ -277,25 +277,48 @@ function synthesizeJavaAnonymousClassDeclarations(rootNode) {
277
277
  // constant's class extends its HOST ENUM (javac semantics), so the
278
278
  // inherits reference names the enum — giving `mroFor(E$N) ∋ E` and
279
279
  // keeping bare calls from the body to the enum's own helpers alive
280
- // through the ownership gate's MRO arm. No receiver typeBinding piece:
281
- // constants are not variable initializers; `E.A.hook()` dispatch rides
282
- // the existing enum receiver machinery.
280
+ // through the ownership gate's MRO arm.
283
281
  for (const constant of rootNode.descendantsOfType('enum_constant')) {
284
- const name = synthesizeJavaAnonymousClassName(constant);
285
- if (name === undefined)
286
- continue;
287
- const body = constant.childForFieldName?.('body');
288
- if (body === null || body === undefined || body.type !== 'class_body')
289
- continue;
290
- out.push({
291
- '@declaration.class': nodeToCapture('@declaration.class', body),
292
- '@declaration.name': syntheticCapture('@declaration.name', body, name),
293
- });
294
282
  const hostEnum = javaEnclosingEnumNameOf(constant);
295
- if (hostEnum !== undefined) {
283
+ const bodyNode = constant.childForFieldName?.('body');
284
+ const isBodied = bodyNode !== null && bodyNode !== undefined && bodyNode.type === 'class_body';
285
+ const bodiedName = synthesizeJavaAnonymousClassName(constant);
286
+ if (bodiedName !== undefined && isBodied) {
296
287
  out.push({
297
- '@reference.inherits': nodeToCapture('@reference.inherits', body),
298
- '@reference.name': syntheticCapture('@reference.name', body, hostEnum),
288
+ '@declaration.class': nodeToCapture('@declaration.class', bodyNode),
289
+ '@declaration.name': syntheticCapture('@declaration.name', bodyNode, bodiedName),
290
+ });
291
+ if (hostEnum !== undefined) {
292
+ out.push({
293
+ '@reference.inherits': nodeToCapture('@reference.inherits', bodyNode),
294
+ '@reference.name': syntheticCapture('@reference.name', bodyNode, hostEnum),
295
+ });
296
+ }
297
+ }
298
+ // Receiver dispatch (#2561): `E.CONST.method()` resolves through the
299
+ // generic compound-receiver chain walk, which looks up each dotted
300
+ // segment via the owning class scope's `typeBindings` map — the same
301
+ // mechanism a field declaration uses (`private User user;` binds
302
+ // `user` on the class scope). Binding the constant's own simple name
303
+ // there — to its synthesized `E$N` class when bodied (MRO includes E,
304
+ // so members inherited from the enum still resolve), or to the host
305
+ // enum itself when body-less — makes `E.CONST.method()` resolve with
306
+ // no changes to the shared receiver-binding machinery.
307
+ //
308
+ // A bodied constant binds ONLY to its `E$N` class, never the host enum:
309
+ // if name synthesis fails on a malformed/error-recovery tree (`bodiedName`
310
+ // undefined despite a real body), emit nothing rather than silently
311
+ // misattributing an OVERRIDING constant's receiver to the enum's own
312
+ // (non-overridden) method — a wrong edge is worse than no edge. Mirrors
313
+ // the `object_creation_expression` branch, which skips on synthesis
314
+ // failure. `hostEnum` is used only for genuinely body-less constants.
315
+ const constantNameNode = constant.childForFieldName?.('name');
316
+ const constantType = isBodied ? bodiedName : hostEnum;
317
+ if (constantNameNode !== null && constantNameNode !== undefined && constantType !== undefined) {
318
+ out.push({
319
+ '@type-binding.annotation': nodeToCapture('@type-binding.annotation', constant),
320
+ '@type-binding.name': nodeToCapture('@type-binding.name', constantNameNode),
321
+ '@type-binding.type': syntheticCapture('@type-binding.type', constant, constantType),
299
322
  });
300
323
  }
301
324
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gitnexus",
3
- "version": "1.6.10-rc.74",
3
+ "version": "1.6.10-rc.76",
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",