From 7906ccf7eae8a6812554dc3da014b0007c8331bb Mon Sep 17 00:00:00 2001 From: Kallen Tu Date: Thu, 6 Apr 2023 23:12:58 +0000 Subject: [PATCH] [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 Reviewed-by: Paul Berry --- .../lib/src/utilities/extensions/library_element.dart | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/pkg/analyzer/lib/src/utilities/extensions/library_element.dart b/pkg/analyzer/lib/src/utilities/extensions/library_element.dart index d8d8fc29522..45f8f13032c 100644 --- a/pkg/analyzer/lib/src/utilities/extensions/library_element.dart +++ b/pkg/analyzer/lib/src/utilities/extensions/library_element.dart @@ -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) {