Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Consolidate TypedScopeCreator's ScopeBuilders
LocalScopeBuilder and GlobalScopeBuilder were basically doing the same thing, with the only difference being how function scopes were handled. With ES6 block scoping, function scopes are much more limited: they never include any statements and therefore don't have any declarations. This change combines the existing two concrete ScopeBuilder subclasses into a NormalScopeBuilder, but pulls out the separate behavior for FunctionScopeBuilder into its own place, differentiated by completely different shouldTraverse() and visit() logic. It turns out that much of the complex type creation logic is actually still needed in both, since blockless arrow functions and default parameter initializers still allow object literals to exist directly in function scopes - so parsing JSDoc function declarations (etc) is still required. But we can get by with less branching and special casing in shouldTraverse, and this opens the door to a separate ClassScopeBuilder in the near future with its own separate logic. ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=198965310
- Loading branch information