No successful run was found on main (94fb705) during the generation of this report, so 055322c was used instead as the comparison base. There might be some changes unrelated to this pull request in this report.
feat(es/compiler): Merge nullish_coalescing into swc_ecma_compiler
This change consolidates the nullish coalescing transformation into the
swc_ecma_compiler crate to reduce visitor overhead and improve performance
by minimizing AST traversals.
**Changes:**
1. Added NULLISH_COALESCING feature flag to Features bitflags
2. Created es2020/nullish_coalescing.rs module with transformation logic
3. Integrated transformation into CompilerImpl visitor methods:
- visit_mut_expr: Transform ?? and ??= operators
- visit_mut_block_stmt: Prevent #1123 by scoping variables
- visit_mut_switch_case: Prevent #1123 and #6328 by scoping variables
- visit_mut_block_stmt_or_expr: Convert expressions to block statements when needed
- visit_mut_module_items/visit_mut_stmts: Hoist generated variables
4. Updated swc_ecma_compat_es2020 to use Compiler with thin wrapper
5. Maintained backward compatibility and configuration API
**Testing:**
- All existing nullish coalescing tests pass (8/12 passed, 4 require mocha)
- swc_ecma_compiler and swc_ecma_compat_es2020 tests pass
**Related:**
- Part of effort to reduce visitor overhead by ~90%
- Follows patterns from PRs #10909, #10914, #10917
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
2315412
4 days ago
by github-actions[bot]
-5.8%
fix(es/compiler): Fix variable hoisting for nullish coalescing and logical assignments
Insert var declarations immediately before the statements that generate them,
rather than hoisting all vars to the top of the block. This matches the
behavior of the original standalone transformations and fixes test failures.
Fixes CI failures in:
- swc_ecma_transforms_compat::es2020_nullish_coalescing tests
- swc_ecma_transforms_typescript::strip tests
- swc project tests
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
ff391ee
4 days ago
by github-actions[bot]
+0.29%
fix(es/compiler): Fix nullish coalescing visitor order to match original implementation
Fix the order of operations in visit_mut_expr to match the original nullish_coalescing implementation. The transformation should be applied AFTER visiting children, not before. This ensures correct behavior for nested expressions and matches the original visitor pattern.
Changes:
- Move transformation logic to execute after visiting children in visit_mut_expr
- This matches the original implementation where e.visit_mut_children_with(self) happens before the match expression
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
cacb2e8
13 hours ago
by github-actions[bot]
+0.05%
Merge branch 'main' into autodev/merge-nullish-coalescing