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

Side by Side Diff: runtime/vm/exceptions.cc

Issue 1318943005: Update range errors to agree on the numbers. (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: More tests Created 5 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #include "vm/exceptions.h" 5 #include "vm/exceptions.h"
6 6
7 #include "platform/address_sanitizer.h" 7 #include "platform/address_sanitizer.h"
8 8
9 #include "vm/dart_api_impl.h" 9 #include "vm/dart_api_impl.h"
10 #include "vm/dart_entry.h" 10 #include "vm/dart_entry.h"
(...skipping 553 matching lines...) Expand 10 before | Expand all | Expand 10 after
564 564
565 void Exceptions::ThrowRangeError(const char* argument_name, 565 void Exceptions::ThrowRangeError(const char* argument_name,
566 const Integer& argument_value, 566 const Integer& argument_value,
567 intptr_t expected_from, 567 intptr_t expected_from,
568 intptr_t expected_to) { 568 intptr_t expected_to) {
569 const Array& args = Array::Handle(Array::New(4)); 569 const Array& args = Array::Handle(Array::New(4));
570 args.SetAt(0, argument_value); 570 args.SetAt(0, argument_value);
571 args.SetAt(1, Integer::Handle(Integer::New(expected_from))); 571 args.SetAt(1, Integer::Handle(Integer::New(expected_from)));
572 args.SetAt(2, Integer::Handle(Integer::New(expected_to))); 572 args.SetAt(2, Integer::Handle(Integer::New(expected_to)));
573 args.SetAt(3, String::Handle(String::New(argument_name))); 573 args.SetAt(3, String::Handle(String::New(argument_name)));
574 Exceptions::ThrowByType(Exceptions::kRangeRange, args); 574 Exceptions::ThrowByType(Exceptions::kRange, args);
575 } 575 }
576 576
577 577
578 RawObject* Exceptions::Create(ExceptionType type, const Array& arguments) { 578 RawObject* Exceptions::Create(ExceptionType type, const Array& arguments) {
579 Library& library = Library::Handle(); 579 Library& library = Library::Handle();
580 const String* class_name = NULL; 580 const String* class_name = NULL;
581 const String* constructor_name = &Symbols::Dot(); 581 const String* constructor_name = &Symbols::Dot();
582 switch (type) { 582 switch (type) {
583 case kNone: 583 case kNone:
584 case kStackOverflow: 584 case kStackOverflow:
585 case kOutOfMemory: 585 case kOutOfMemory:
586 UNREACHABLE(); 586 UNREACHABLE();
587 break; 587 break;
588 case kRange: 588 case kRange:
589 library = Library::CoreLibrary(); 589 library = Library::CoreLibrary();
590 class_name = &Symbols::RangeError(); 590 class_name = &Symbols::RangeError();
591 break;
592 case kRangeRange:
593 library = Library::CoreLibrary();
594 class_name = &Symbols::RangeError();
595 constructor_name = &Symbols::DotRange(); 591 constructor_name = &Symbols::DotRange();
596 break; 592 break;
597 case kArgument: 593 case kArgument:
598 library = Library::CoreLibrary(); 594 library = Library::CoreLibrary();
599 class_name = &Symbols::ArgumentError(); 595 class_name = &Symbols::ArgumentError();
600 break; 596 break;
601 case kArgumentValue: 597 case kArgumentValue:
602 library = Library::CoreLibrary(); 598 library = Library::CoreLibrary();
603 class_name = &Symbols::ArgumentError(); 599 class_name = &Symbols::ArgumentError();
604 constructor_name = &Symbols::DotValue(); 600 constructor_name = &Symbols::DotValue();
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
675 671
676 // Throw JavascriptCompatibilityError exception. 672 // Throw JavascriptCompatibilityError exception.
677 void Exceptions::ThrowJavascriptCompatibilityError(const char* msg) { 673 void Exceptions::ThrowJavascriptCompatibilityError(const char* msg) {
678 const Array& exc_args = Array::Handle(Array::New(1)); 674 const Array& exc_args = Array::Handle(Array::New(1));
679 const String& msg_str = String::Handle(String::New(msg)); 675 const String& msg_str = String::Handle(String::New(msg));
680 exc_args.SetAt(0, msg_str); 676 exc_args.SetAt(0, msg_str);
681 Exceptions::ThrowByType(Exceptions::kJavascriptCompatibilityError, exc_args); 677 Exceptions::ThrowByType(Exceptions::kJavascriptCompatibilityError, exc_args);
682 } 678 }
683 679
684 } // namespace dart 680 } // namespace dart
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698