| OLD | NEW |
| 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 "lib/stacktrace.h" | 9 #include "lib/stacktrace.h" |
| 10 | 10 |
| (...skipping 701 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 712 intptr_t expected_to) { | 712 intptr_t expected_to) { |
| 713 const Array& args = Array::Handle(Array::New(4)); | 713 const Array& args = Array::Handle(Array::New(4)); |
| 714 args.SetAt(0, argument_value); | 714 args.SetAt(0, argument_value); |
| 715 args.SetAt(1, Integer::Handle(Integer::New(expected_from))); | 715 args.SetAt(1, Integer::Handle(Integer::New(expected_from))); |
| 716 args.SetAt(2, Integer::Handle(Integer::New(expected_to))); | 716 args.SetAt(2, Integer::Handle(Integer::New(expected_to))); |
| 717 args.SetAt(3, String::Handle(String::New(argument_name))); | 717 args.SetAt(3, String::Handle(String::New(argument_name))); |
| 718 Exceptions::ThrowByType(Exceptions::kRange, args); | 718 Exceptions::ThrowByType(Exceptions::kRange, args); |
| 719 } | 719 } |
| 720 | 720 |
| 721 | 721 |
| 722 void Exceptions::ThrowRangeErrorMsg(const char* msg) { |
| 723 const Array& args = Array::Handle(Array::New(1)); |
| 724 args.SetAt(0, String::Handle(String::New(msg))); |
| 725 Exceptions::ThrowByType(Exceptions::kRangeMsg, args); |
| 726 } |
| 727 |
| 728 |
| 722 void Exceptions::ThrowCompileTimeError(const LanguageError& error) { | 729 void Exceptions::ThrowCompileTimeError(const LanguageError& error) { |
| 723 const Array& args = Array::Handle(Array::New(1)); | 730 const Array& args = Array::Handle(Array::New(1)); |
| 724 args.SetAt(0, String::Handle(error.FormatMessage())); | 731 args.SetAt(0, String::Handle(error.FormatMessage())); |
| 725 Exceptions::ThrowByType(Exceptions::kCompileTimeError, args); | 732 Exceptions::ThrowByType(Exceptions::kCompileTimeError, args); |
| 726 } | 733 } |
| 727 | 734 |
| 728 | 735 |
| 729 RawObject* Exceptions::Create(ExceptionType type, const Array& arguments) { | 736 RawObject* Exceptions::Create(ExceptionType type, const Array& arguments) { |
| 730 Library& library = Library::Handle(); | 737 Library& library = Library::Handle(); |
| 731 const String* class_name = NULL; | 738 const String* class_name = NULL; |
| 732 const String* constructor_name = &Symbols::Dot(); | 739 const String* constructor_name = &Symbols::Dot(); |
| 733 switch (type) { | 740 switch (type) { |
| 734 case kNone: | 741 case kNone: |
| 735 case kStackOverflow: | 742 case kStackOverflow: |
| 736 case kOutOfMemory: | 743 case kOutOfMemory: |
| 737 UNREACHABLE(); | 744 UNREACHABLE(); |
| 738 break; | 745 break; |
| 739 case kRange: | 746 case kRange: |
| 740 library = Library::CoreLibrary(); | 747 library = Library::CoreLibrary(); |
| 741 class_name = &Symbols::RangeError(); | 748 class_name = &Symbols::RangeError(); |
| 742 constructor_name = &Symbols::DotRange(); | 749 constructor_name = &Symbols::DotRange(); |
| 743 break; | 750 break; |
| 751 case kRangeMsg: |
| 752 library = Library::CoreLibrary(); |
| 753 class_name = &Symbols::RangeError(); |
| 754 constructor_name = &Symbols::Dot(); |
| 755 break; |
| 744 case kArgument: | 756 case kArgument: |
| 745 library = Library::CoreLibrary(); | 757 library = Library::CoreLibrary(); |
| 746 class_name = &Symbols::ArgumentError(); | 758 class_name = &Symbols::ArgumentError(); |
| 747 break; | 759 break; |
| 748 case kArgumentValue: | 760 case kArgumentValue: |
| 749 library = Library::CoreLibrary(); | 761 library = Library::CoreLibrary(); |
| 750 class_name = &Symbols::ArgumentError(); | 762 class_name = &Symbols::ArgumentError(); |
| 751 constructor_name = &Symbols::DotValue(); | 763 constructor_name = &Symbols::DotValue(); |
| 752 break; | 764 break; |
| 753 case kNoSuchMethod: | 765 case kNoSuchMethod: |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 805 class_name = &Symbols::_CompileTimeError(); | 817 class_name = &Symbols::_CompileTimeError(); |
| 806 break; | 818 break; |
| 807 } | 819 } |
| 808 | 820 |
| 809 return DartLibraryCalls::InstanceCreate(library, *class_name, | 821 return DartLibraryCalls::InstanceCreate(library, *class_name, |
| 810 *constructor_name, arguments); | 822 *constructor_name, arguments); |
| 811 } | 823 } |
| 812 | 824 |
| 813 | 825 |
| 814 } // namespace dart | 826 } // namespace dart |
| OLD | NEW |