Commit 1e683f9
committed
fix(traverse):
Fixes #9702.
Fix `ChildScopeCollector` so it doesn't miss out scopes in some cases.
Previously when a struct has its own scope, the visitor does not visit any of the struct's fields. But this is incorrect where the type's scope does not cover all of its fields (the scope starts late / ends early). If the fields outside of the scope may themselves have scopes, then those scopes are direct children of the starting point.
These types are:
* `Class` (`decorators` is outside `Class`'s scope).
* `SwitchStatement` (`discriminant` is outside `SwitchStatement`'s scope).
* `TSConditionalType` (`check_type` and `false_type` are outside `TSConditionalType`'s scope).
Additionally, make the visitor more efficient by not bothering to visit any struct fields / enum variants which don't contain a scope anywhere in their dependencies.ChildScopeCollector visit all scopes (#10292)1 parent 521de23 commit 1e683f9
File tree
5 files changed
+2421
-88
lines changed- crates/oxc_traverse/src/generated
- tasks/ast_tools/src
- generators
- schema/extensions
5 files changed
+2421
-88
lines changed
0 commit comments