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

Unified Diff: runtime/lib/double.cc

Issue 25566002: Factor out throwing of argument error. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 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
« no previous file with comments | « runtime/lib/date.cc ('k') | runtime/lib/integers.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/lib/double.cc
===================================================================
--- runtime/lib/double.cc (revision 28096)
+++ runtime/lib/double.cc (working copy)
@@ -219,10 +219,8 @@
&& kLowerBoundary < d && d < kUpperBoundary) {
return DoubleToStringAsFixed(d, static_cast<int>(fraction_digits_value));
} else {
- const Array& args = Array::Handle(Array::New(1));
- args.SetAt(0, String::Handle(
+ Exceptions::ThrowArgumentError(String::Handle(
String::New("Illegal arguments to double.toStringAsFixed")));
- Exceptions::ThrowByType(Exceptions::kArgument, args);
return Object::null();
}
}
@@ -237,10 +235,8 @@
return DoubleToStringAsExponential(
d, static_cast<int>(fraction_digits_value));
} else {
- const Array& args = Array::Handle(Array::New(1));
- args.SetAt(0, String::Handle(
+ Exceptions::ThrowArgumentError(String::Handle(
String::New("Illegal arguments to double.toStringAsExponential")));
- Exceptions::ThrowByType(Exceptions::kArgument, args);
return Object::null();
}
}
@@ -254,10 +250,8 @@
if (1 <= precision_value && precision_value <= 21) {
return DoubleToStringAsPrecision(d, static_cast<int>(precision_value));
} else {
- const Array& args = Array::Handle(Array::New(1));
- args.SetAt(0, String::Handle(
+ Exceptions::ThrowArgumentError(String::Handle(
String::New("Illegal arguments to double.toStringAsPrecision")));
- Exceptions::ThrowByType(Exceptions::kArgument, args);
return Object::null();
}
}
« no previous file with comments | « runtime/lib/date.cc ('k') | runtime/lib/integers.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698