[analyzer] Start using IndexError.check in library_element.
Reverses https://dart-review.googlesource.com/c/sdk/+/269141. Now that the pubspec specifies 2.19 as the minimum version, we can swap to IndexError.check instead of checkValidIndex. Change-Id: I0dab64b4c8408a29b8bea35920e3f5e69e6e92d9 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/294124 Commit-Queue: Kallen Tu <kallentu@google.com> Reviewed-by: Paul Berry <paulberry@google.com>
This commit is contained in:
@@ -21,9 +21,7 @@ extension _ElementExtension on Element {
|
||||
/// is a match up to [thisIndex].
|
||||
Element? _locateElement(ElementLocation location, int thisIndex) {
|
||||
final components = location.components;
|
||||
// TODO(paulberry): once the analyzer's pubspec specifies a minimum SDK
|
||||
// version that supports [IndexError.check], switch to using that instead.
|
||||
RangeError.checkValidIndex(thisIndex, components);
|
||||
IndexError.check(thisIndex, components.length, indexable: components);
|
||||
|
||||
final nextIndex = thisIndex + 1;
|
||||
if (nextIndex == components.length) {
|
||||
|
||||
Reference in New Issue
Block a user