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

Unified Diff: runtime/lib/growable_array.cc

Issue 1318943005: Update range errors to agree on the numbers. (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Tweak JS output. Created 5 years, 3 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
Index: runtime/lib/growable_array.cc
diff --git a/runtime/lib/growable_array.cc b/runtime/lib/growable_array.cc
index 8181e737229aeb4c153157cda13f063797a1315e..cd8600ff215d44c6af3af4acc6af163528914073 100644
--- a/runtime/lib/growable_array.cc
+++ b/runtime/lib/growable_array.cc
@@ -35,7 +35,7 @@ DEFINE_NATIVE_ENTRY(GrowableList_getIndexed, 2) {
GrowableObjectArray::CheckedHandle(arguments->NativeArgAt(0));
GET_NON_NULL_NATIVE_ARGUMENT(Smi, index, arguments->NativeArgAt(1));
if ((index.Value() < 0) || (index.Value() >= array.Length())) {
- Exceptions::ThrowRangeError("index", index, 0, array.Length());
+ Exceptions::ThrowRangeError("index", index, 0, array.Length() - 1);
}
const Instance& obj = Instance::CheckedHandle(array.At(index.Value()));
return obj.raw();
@@ -47,7 +47,7 @@ DEFINE_NATIVE_ENTRY(GrowableList_setIndexed, 3) {
GrowableObjectArray::CheckedHandle(arguments->NativeArgAt(0));
GET_NON_NULL_NATIVE_ARGUMENT(Smi, index, arguments->NativeArgAt(1));
if ((index.Value() < 0) || (index.Value() >= array.Length())) {
- Exceptions::ThrowRangeError("index", index, 0, array.Length());
+ Exceptions::ThrowRangeError("index", index, 0, array.Length() - 1);
}
GET_NON_NULL_NATIVE_ARGUMENT(Instance, value, arguments->NativeArgAt(2));
array.SetAt(index.Value(), value);

Powered by Google App Engine
This is Rietveld 408576698