Start to refactor ElementMatcher

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>

https://dart.googlesource.com/sdk/+/df2e8fedbbe23e5a79dbda114c2ff3c115ac85a1
1 file changed
tree: 71bbcad063fede7bdc3ed313e9c3676228508698
  1. commits.json