df2e8fedbb
This is the first of multiple smaller CLs to refactor `ElementMatcher`. I was starting to fix a bug and realized that the current implementation allows the number of components to be out of sync with the element kind. The primary goal is to prevent that by eventually merging the methods `_componentsForNode` and `_kindsForNode` into a single method (`buildMatchersForNode`). In the process I realized that we can sometimes match either a top-level declaraation or an instance member from a superclass, and that means that we need multiple matchers (otherwise I think the number of components will continue to be out-of-sync with the element kinds). This CL also includes the failing test that started the whole investigation into refactoring this class. Change-Id: I0c3a56f29f0f6c6d0cad6ac80145b26201931518 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/228722 Reviewed-by: Konstantin Shcheglov <scheglov@google.com> Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>