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

Unified Diff: runtime/vm/exceptions.cc

Issue 1160903002: Revert "Change RangeError instances to use RangeError.range." (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: 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/symbols.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 fa2e44179de9d83d7c11aceb4fa1899363a25afb..75ef32219aac6850e4f4609668c7ac7c55d6ff47 100644
--- a/runtime/vm/exceptions.cc
+++ b/runtime/vm/exceptions.cc
@@ -566,12 +566,16 @@ void Exceptions::ThrowRangeError(const char* argument_name,
const Integer& argument_value,
intptr_t expected_from,
intptr_t expected_to) {
- 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);
+ 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);
}
@@ -589,11 +593,6 @@ 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/symbols.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698