| 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 "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 633 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 644 intptr_t expected_to) { | 644 intptr_t expected_to) { |
| 645 const Array& args = Array::Handle(Array::New(4)); | 645 const Array& args = Array::Handle(Array::New(4)); |
| 646 args.SetAt(0, argument_value); | 646 args.SetAt(0, argument_value); |
| 647 args.SetAt(1, Integer::Handle(Integer::New(expected_from))); | 647 args.SetAt(1, Integer::Handle(Integer::New(expected_from))); |
| 648 args.SetAt(2, Integer::Handle(Integer::New(expected_to))); | 648 args.SetAt(2, Integer::Handle(Integer::New(expected_to))); |
| 649 args.SetAt(3, String::Handle(String::New(argument_name))); | 649 args.SetAt(3, String::Handle(String::New(argument_name))); |
| 650 Exceptions::ThrowByType(Exceptions::kRange, args); | 650 Exceptions::ThrowByType(Exceptions::kRange, args); |
| 651 } | 651 } |
| 652 | 652 |
| 653 | 653 |
| 654 void Exceptions::ThrowCompileTimeError(const LanguageError& error) { |
| 655 const Array& args = Array::Handle(Array::New(1)); |
| 656 args.SetAt(0, String::Handle(error.FormatMessage())); |
| 657 Exceptions::ThrowByType(Exceptions::kCompileTimeError, args); |
| 658 } |
| 659 |
| 660 |
| 654 RawObject* Exceptions::Create(ExceptionType type, const Array& arguments) { | 661 RawObject* Exceptions::Create(ExceptionType type, const Array& arguments) { |
| 655 Library& library = Library::Handle(); | 662 Library& library = Library::Handle(); |
| 656 const String* class_name = NULL; | 663 const String* class_name = NULL; |
| 657 const String* constructor_name = &Symbols::Dot(); | 664 const String* constructor_name = &Symbols::Dot(); |
| 658 switch (type) { | 665 switch (type) { |
| 659 case kNone: | 666 case kNone: |
| 660 case kStackOverflow: | 667 case kStackOverflow: |
| 661 case kOutOfMemory: | 668 case kOutOfMemory: |
| 662 UNREACHABLE(); | 669 UNREACHABLE(); |
| 663 break; | 670 break; |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 717 constructor_name = &Symbols::DotCreate(); | 724 constructor_name = &Symbols::DotCreate(); |
| 718 break; | 725 break; |
| 719 case kAbstractClassInstantiation: | 726 case kAbstractClassInstantiation: |
| 720 library = Library::CoreLibrary(); | 727 library = Library::CoreLibrary(); |
| 721 class_name = &Symbols::AbstractClassInstantiationError(); | 728 class_name = &Symbols::AbstractClassInstantiationError(); |
| 722 constructor_name = &Symbols::DotCreate(); | 729 constructor_name = &Symbols::DotCreate(); |
| 723 break; | 730 break; |
| 724 case kCyclicInitializationError: | 731 case kCyclicInitializationError: |
| 725 library = Library::CoreLibrary(); | 732 library = Library::CoreLibrary(); |
| 726 class_name = &Symbols::CyclicInitializationError(); | 733 class_name = &Symbols::CyclicInitializationError(); |
| 734 break; |
| 735 case kCompileTimeError: |
| 736 library = Library::CoreLibrary(); |
| 737 class_name = &Symbols::_CompileTimeError(); |
| 738 break; |
| 727 } | 739 } |
| 728 | 740 |
| 729 return DartLibraryCalls::InstanceCreate(library, | 741 return DartLibraryCalls::InstanceCreate(library, |
| 730 *class_name, | 742 *class_name, |
| 731 *constructor_name, | 743 *constructor_name, |
| 732 arguments); | 744 arguments); |
| 733 } | 745 } |
| 734 | 746 |
| 735 | 747 |
| 736 } // namespace dart | 748 } // namespace dart |
| OLD | NEW |