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

Unified Diff: lib/double.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/date.cc ('k') | lib/growable_array.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/double.cc
===================================================================
--- lib/double.cc (revision 16285)
+++ lib/double.cc (working copy)
@@ -189,9 +189,8 @@
DEFINE_NATIVE_ENTRY(Double_toInt, 1) {
const Double& arg = Double::CheckedHandle(arguments->NativeArgAt(0));
if (isinf(arg.value()) || isnan(arg.value())) {
- GrowableArray<const Object*> args;
- args.Add(&String::ZoneHandle(String::New(
- "Infinity or NaN toInt")));
+ const Array& args = Array::Handle(Array::New(1));
+ args.SetAt(0, String::Handle(String::New("Infinity or NaN toInt")));
Exceptions::ThrowByType(Exceptions::kFormat, args);
}
double result = trunc(arg.value());
@@ -253,8 +252,8 @@
}
}
- GrowableArray<const Object*> args;
- args.Add(&value);
+ const Array& args = Array::Handle(Array::New(1));
+ args.SetAt(0, value);
Exceptions::ThrowByType(Exceptions::kFormat, args);
return Object::null();
}
@@ -273,9 +272,9 @@
&& kLowerBoundary < d && d < kUpperBoundary) {
return DoubleToStringAsFixed(d, static_cast<int>(fraction_digits_value));
} else {
- GrowableArray<const Object*> args;
- args.Add(&String::ZoneHandle(String::New(
- "Illegal arguments to double.toStringAsFixed")));
+ const Array& args = Array::Handle(Array::New(1));
+ args.SetAt(0, String::Handle(
+ String::New("Illegal arguments to double.toStringAsFixed")));
Exceptions::ThrowByType(Exceptions::kArgument, args);
return Object::null();
}
@@ -291,9 +290,9 @@
return DoubleToStringAsExponential(
d, static_cast<int>(fraction_digits_value));
} else {
- GrowableArray<const Object*> args;
- args.Add(&String::ZoneHandle(String::New(
- "Illegal arguments to double.toStringAsExponential")));
+ const Array& args = Array::Handle(Array::New(1));
+ args.SetAt(0, String::Handle(
+ String::New("Illegal arguments to double.toStringAsExponential")));
Exceptions::ThrowByType(Exceptions::kArgument, args);
return Object::null();
}
@@ -308,9 +307,9 @@
if (1 <= precision_value && precision_value <= 21) {
return DoubleToStringAsPrecision(d, static_cast<int>(precision_value));
} else {
- GrowableArray<const Object*> args;
- args.Add(&String::ZoneHandle(String::New(
- "Illegal arguments to double.toStringAsPrecision")));
+ const Array& args = Array::Handle(Array::New(1));
+ args.SetAt(0, String::Handle(
+ String::New("Illegal arguments to double.toStringAsPrecision")));
Exceptions::ThrowByType(Exceptions::kArgument, args);
return Object::null();
}
« no previous file with comments | « lib/date.cc ('k') | lib/growable_array.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698