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

Unified Diff: lib/string.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 | « lib/regexp_jsc.cc ('k') | vm/bigint_operations.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/string.cc
===================================================================
--- lib/string.cc (revision 16285)
+++ lib/string.cc (working copy)
@@ -26,13 +26,13 @@
for (intptr_t i = 0; i < array_len; i++) {
index_object = a.At(i);
if (!index_object.IsSmi()) {
- GrowableArray<const Object*> args;
- args.Add(&index_object);
+ const Array& args = Array::Handle(Array::New(1));
+ args.SetAt(0, index_object);
Exceptions::ThrowByType(Exceptions::kArgument, args);
}
intptr_t value = Smi::Cast(index_object).Value();
if (Utf::IsOutOfRange(value)) {
- GrowableArray<const Object*> args;
+ const Array& args = Array::Handle(Object::empty_array());
Exceptions::ThrowByType(Exceptions::kArgument, args);
} else {
if (!Utf::IsLatin1(value)) {
@@ -128,16 +128,16 @@
smi ^= index.raw();
int32_t index = smi.Value();
if ((index < 0) || (index >= str.Length())) {
- GrowableArray<const Object*> arguments;
- arguments.Add(&smi);
- Exceptions::ThrowByType(Exceptions::kRange, arguments);
+ const Array& args = Array::Handle(Array::New(1));
+ args.SetAt(0, smi);
+ Exceptions::ThrowByType(Exceptions::kRange, args);
}
return str.CharAt(index);
} else {
// An index larger than Smi is always illegal.
- 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 0;
}
}
@@ -191,8 +191,8 @@
for (intptr_t i = 0; i < strings.Length(); i++) {
elem ^= strings.At(i);
if (!elem.IsString()) {
- GrowableArray<const Object*> args;
- args.Add(&elem);
+ const Array& args = Array::Handle(Array::New(1));
+ args.SetAt(0, elem);
Exceptions::ThrowByType(Exceptions::kArgument, args);
}
}
« no previous file with comments | « lib/regexp_jsc.cc ('k') | vm/bigint_operations.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698