Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(102)

Unified Diff: runtime/lib/typed_data_patch.dart

Issue 2685783009: (Re)move methods from internal.Lists that are not used, or only used once. (Closed)
Patch Set: Merge to head. Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « runtime/lib/internal_patch.dart ('k') | sdk/lib/internal/internal.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/lib/typed_data_patch.dart
diff --git a/runtime/lib/typed_data_patch.dart b/runtime/lib/typed_data_patch.dart
index ab055ee6216b5ace748d3bc1ecffd97b3df516fc..fd45d39c6fa1599aad8f8150533ef9d7e1881980 100644
--- a/runtime/lib/typed_data_patch.dart
+++ b/runtime/lib/typed_data_patch.dart
@@ -179,12 +179,27 @@ abstract class _TypedListBase {
}
int indexOf(element, [int start = 0]) {
- return Lists.indexOf(this, element, start, this.length);
+ if (start >= this.length) {
+ return -1;
+ } else if (start < 0) {
+ start = 0;
+ }
+ for (int i = start; i < this.length; i++) {
+ if (this[i] == element) return i;
+ }
+ return -1;
}
int lastIndexOf(element, [int start = null]) {
- if (start == null) start = this.length - 1;
- return Lists.lastIndexOf(this, element, start);
+ if (start == null || start >= this.length) {
+ start = this.length - 1;
+ } else if (start < 0) {
+ return -1;
+ }
+ for (int i = start; i >= 0; i--) {
+ if (this[i] == element) return i;
+ }
+ return -1;
}
void clear() {
« no previous file with comments | « runtime/lib/internal_patch.dart ('k') | sdk/lib/internal/internal.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698