ucn 5.5.0 → 5.5.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
@@ -2620,10 +2620,13 @@ class ProjectIndex {
2620
2620
  if (exact) return returnSymbol ? exact : exact.name;
2621
2621
  }
2622
2622
 
2623
- // Per-operation cache: avoid rescanning symbols for same (file, line)
2624
- const cacheKey = filePath + '\0' + lineNum;
2623
+ // Per-operation cache: avoid rescanning symbols for same (file, line),
2624
+ // keyed per file then line (no composed key string per call).
2625
+ let byLine = null;
2625
2626
  if (this._opEnclosingFnCache) {
2626
- const cached = this._opEnclosingFnCache.get(cacheKey);
2627
+ byLine = this._opEnclosingFnCache.get(filePath);
2628
+ if (!byLine) this._opEnclosingFnCache.set(filePath, byLine = new Map());
2629
+ const cached = byLine.get(lineNum);
2627
2630
  if (cached !== undefined) {
2628
2631
  return cached === null ? null : (returnSymbol ? cached : cached.name);
2629
2632
  }
@@ -2640,9 +2643,7 @@ class ProjectIndex {
2640
2643
  }
2641
2644
  }
2642
2645
 
2643
- if (this._opEnclosingFnCache) {
2644
- this._opEnclosingFnCache.set(cacheKey, best);
2645
- }
2646
+ if (byLine) byLine.set(lineNum, best);
2646
2647
  return best ? (returnSymbol ? best : best.name) : null;
2647
2648
  }
2648
2649
 
@@ -2932,6 +2933,14 @@ class ProjectIndex {
2932
2933
  /** Save index to cache file */
2933
2934
  saveCache(cachePath) { return indexCache.saveCache(this, cachePath); }
2934
2935
 
2936
+ /**
2937
+ * Derive whole the Rust files whose macro-expansion calls were derived
2938
+ * in part (fix #405), so a saved cache holds them. Returns the count.
2939
+ */
2940
+ completeMacroCallDerivations() {
2941
+ return this._rustMacroState ? require('./rust-macro-expansion').completeRustMacroCalls(this) : 0;
2942
+ }
2943
+
2935
2944
  /** Load index from cache file */
2936
2945
  /**
2937
2946
  * Build under the cross-process build lock (fix #354) and save the cache.