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() { |