You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* Fix: Filter synthetic map params from outer scope derives
Fixes bug where element/index/array leaked into outer scope derives.
Adds special case handling for single non-synthetic dataflow with synthetic map params.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
* Refactor: Replace heuristics with explicit map callback tracking
Replaces fragile heuristic-based detection of map callbacks with explicit
marking using a shared WeakSet registry. This fixes bugs where synthetic
identifiers (element, index, array) leaked into outer scope derives.
**Problem:**
- ClosureTransformer creates synthetic identifiers without symbols for map params
- OpaqueRefJSXTransformer analyzes transformed AST and needs to distinguish:
1. Synthetic params INSIDE map callbacks (keep)
2. Synthetic params that leaked to outer scope (filter out)
- Previous heuristics based on counting dataflows were brittle and error-prone
**Solution:**
1. Add `mapCallbackRegistry: WeakSet<ts.Node>` to TransformationOptions
2. ClosureTransformer marks arrow functions when creating map callbacks
3. OpaqueRefJSXTransformer checks marking to detect map callback scopes
4. Filter logic:
- Only synthetic dataflows → inside callback (keep all)
- Mixed synthetic + non-synthetic → check if in marked callback
- If not in marked callback → filter out synthetic params
**Benefits:**
- Direct knowledge instead of heuristics (no more magic thresholds)
- Clear contract between transformers via shared registry
- More maintainable - reduced from ~130 lines to ~100 lines
- Fixes "element is not defined" runtime errors
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
---------
Co-authored-by: Claude <noreply@anthropic.com>
0 commit comments