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

Unified Diff: runtime/vm/exceptions.cc

Issue 1132603003: Change RangeError instances to use RangeError.range. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Adapt function fingerprints too. Created 5 years, 7 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/vm/exceptions.h ('k') | runtime/vm/method_recognizer.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/exceptions.cc
diff --git a/runtime/vm/exceptions.cc b/runtime/vm/exceptions.cc
index 75ef32219aac6850e4f4609668c7ac7c55d6ff47..fa2e44179de9d83d7c11aceb4fa1899363a25afb 100644
--- a/runtime/vm/exceptions.cc
+++ b/runtime/vm/exceptions.cc
@@ -566,16 +566,12 @@ void Exceptions::ThrowRangeError(const char* argument_name,
const Integer& argument_value,
intptr_t expected_from,
intptr_t expected_to) {
- const String& error = String::Handle(String::NewFormatted(
- "%s (%s) must be in the range [%" Pd "..%" Pd ")",
- argument_name,
- argument_value.ToCString(),
- expected_from,
- expected_to));
-
- const Array& args = Array::Handle(Array::New(1));
- args.SetAt(0, error);
- Exceptions::ThrowByType(Exceptions::kRange, args);
+ const Array& args = Array::Handle(Array::New(4));
+ args.SetAt(0, argument_value);
+ args.SetAt(1, Integer::Handle(Integer::New(expected_from)));
+ args.SetAt(2, Integer::Handle(Integer::New(expected_to)));
+ args.SetAt(3, String::Handle(String::New(argument_name)));
+ Exceptions::ThrowByType(Exceptions::kRangeRange, args);
}
@@ -593,6 +589,11 @@ RawObject* Exceptions::Create(ExceptionType type, const Array& arguments) {
library = Library::CoreLibrary();
class_name = &Symbols::RangeError();
break;
+ case kRangeRange:
+ library = Library::CoreLibrary();
+ class_name = &Symbols::RangeError();
+ constructor_name = &Symbols::DotRange();
+ break;
case kArgument:
library = Library::CoreLibrary();
class_name = &Symbols::ArgumentError();
« no previous file with comments | « runtime/vm/exceptions.h ('k') | runtime/vm/method_recognizer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698