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

Unified Diff: lib/array.cc

Issue 11639007: Cleanup the exceptions create code to use Arrays instead GrowableArrays so (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/runtime/
Patch Set: Created 8 years 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 | « no previous file | lib/byte_array.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/array.cc
===================================================================
--- lib/array.cc (revision 16285)
+++ lib/array.cc (working copy)
@@ -23,8 +23,8 @@
const String& error = String::Handle(String::NewFormatted(
"length (%"Pd") must be in the range [0..%"Pd"]",
len, Array::kMaxElements));
- GrowableArray<const Object*> args;
- args.Add(&error);
+ const Array& args = Array::Handle(Array::New(1));
+ args.SetAt(0, error);
Exceptions::ThrowByType(Exceptions::kArgument, args);
}
const Array& new_array = Array::Handle(Array::New(length.Value()));
@@ -37,9 +37,9 @@
const Array& array = Array::CheckedHandle(arguments->NativeArgAt(0));
GET_NON_NULL_NATIVE_ARGUMENT(Smi, index, arguments->NativeArgAt(1));
if ((index.Value() < 0) || (index.Value() >= array.Length())) {
- GrowableArray<const Object*> arguments;
- arguments.Add(&index);
- Exceptions::ThrowByType(Exceptions::kRange, arguments);
+ const Array& args = Array::Handle(Array::New(1));
+ args.SetAt(0, index);
+ Exceptions::ThrowByType(Exceptions::kRange, args);
}
return array.At(index.Value());
}
@@ -50,9 +50,9 @@
GET_NON_NULL_NATIVE_ARGUMENT(Smi, index, arguments->NativeArgAt(1));
const Instance& value = Instance::CheckedHandle(arguments->NativeArgAt(2));
if ((index.Value() < 0) || (index.Value() >= array.Length())) {
- GrowableArray<const Object*> arguments;
- arguments.Add(&index);
- Exceptions::ThrowByType(Exceptions::kRange, arguments);
+ const Array& args = Array::Handle(Array::New(1));
+ args.SetAt(0, index);
+ Exceptions::ThrowByType(Exceptions::kRange, args);
}
array.SetAt(index.Value(), value);
return Object::null();
@@ -74,7 +74,7 @@
GET_NON_NULL_NATIVE_ARGUMENT(Smi, count, arguments->NativeArgAt(4));
intptr_t icount = count.Value();
if (icount < 0) {
- GrowableArray<const Object*> args;
+ const Array& args = Array::Handle(Object::empty_array());
Exceptions::ThrowByType(Exceptions::kArgument, args);
}
if (icount == 0) {
@@ -83,14 +83,14 @@
intptr_t isrc_start = src_start.Value();
intptr_t idst_start = dst_start.Value();
if ((isrc_start < 0) || ((isrc_start + icount) > source.Length())) {
- GrowableArray<const Object*> arguments;
- arguments.Add(&src_start);
- Exceptions::ThrowByType(Exceptions::kRange, arguments);
+ const Array& args = Array::Handle(Array::New(1));
+ args.SetAt(0, src_start);
+ Exceptions::ThrowByType(Exceptions::kRange, args);
}
if ((idst_start < 0) || ((idst_start + icount) > dest.Length())) {
- GrowableArray<const Object*> arguments;
- arguments.Add(&dst_start);
- Exceptions::ThrowByType(Exceptions::kRange, arguments);
+ const Array& args = Array::Handle(Array::New(1));
+ args.SetAt(0, dst_start);
+ Exceptions::ThrowByType(Exceptions::kRange, args);
}
Object& src_obj = Object::Handle();
« no previous file with comments | « no previous file | lib/byte_array.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698