ucn 5.1.1 → 5.2.1

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.
package/core/project.js CHANGED
@@ -444,6 +444,9 @@ class ProjectIndex {
444
444
  this._completenessCache = null;
445
445
  this._attrTypeCache = null;
446
446
  this._computedDispatchBlindspots = null;
447
+ this._cppVisibleFilesCache?.clear();
448
+ this._cppTargetVisibilityCache?.clear();
449
+ this._cppMacroParamOutcomesCache?.clear();
447
450
  // Endpoints cache (server routes / client requests / bridges) becomes
448
451
  // stale when files change; clear on every rebuild.
449
452
  this._endpointsCache = null;
@@ -589,6 +592,13 @@ class ProjectIndex {
589
592
  return false;
590
593
  }
591
594
 
595
+ // These query caches depend on project symbols and include closure.
596
+ // A changed file can alter either even before a full rebuild reaches
597
+ // its graph phase, so no prior call-identity verdict may survive.
598
+ this._cppVisibleFilesCache?.clear();
599
+ this._cppTargetVisibilityCache?.clear();
600
+ this._cppMacroParamOutcomesCache?.clear();
601
+
592
602
  if (existing) {
593
603
  this.removeFileSymbols(filePath);
594
604
  }
@@ -942,6 +952,28 @@ class ProjectIndex {
942
952
  return entries;
943
953
  }
944
954
 
955
+ /**
956
+ * Def-exact inheritance parents (fix #300): resolve parents for ONE
957
+ * specific class definition by (file, startLine). Same-name classes in
958
+ * one file (function-local test classes) carry different parents; the
959
+ * file-granular lookup above conflates them. Returns null when no entry
960
+ * matches — for a known def that means it extends nothing (entries are
961
+ * only recorded for extends-bearing defs), which callers must treat as
962
+ * "no parents", never fall back to a sibling def's edges.
963
+ * @param {string} className
964
+ * @param {string} contextFile
965
+ * @param {number} defStartLine
966
+ * @returns {string[]|null}
967
+ */
968
+ _getInheritanceParentsAt(className, contextFile, defStartLine) {
969
+ const entries = this.extendsGraph.get(className);
970
+ if (!entries || entries.length === 0) return null;
971
+ if (typeof entries[0] !== 'object' || entries[0].file === undefined) return null;
972
+ const match = entries.find(e => e.file === contextFile &&
973
+ e.startLine === defStartLine);
974
+ return match ? match.parents : null;
975
+ }
976
+
945
977
  /**
946
978
  * Resolve which file a class is defined in, preferring contextFile.
947
979
  * Used during inheritance BFS to find grandparent chains.
package/core/search.js CHANGED
@@ -352,6 +352,15 @@ function usages(index, name, options = {}) {
352
352
  usageType: u.usageType,
353
353
  isDefinition: false,
354
354
  ...(u.receiver && { receiver: u.receiver }),
355
+ // Refactoring internals need the exact AST token and
356
+ // receiver provenance, but the public usages JSON is a
357
+ // stable line-oriented inventory. Keep this opt-in so
358
+ // plan gains precision without changing that surface.
359
+ ...(options.internalEvidence && {
360
+ ...(Number.isInteger(u.column) && { column: u.column }),
361
+ ...(u.receiverIsModule && { receiverIsModule: true }),
362
+ ...(u.receiverLocalBinding && { receiverLocalBinding: true }),
363
+ }),
355
364
  ...(callerSym && {
356
365
  callerName: callerSym.name,
357
366
  callerStartLine: callerSym.startLine