| 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 622 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 633 intptr_t expected_to) { | 633 intptr_t expected_to) { |
| 634 const Array& args = Array::Handle(Array::New(4)); | 634 const Array& args = Array::Handle(Array::New(4)); |
| 635 args.SetAt(0, argument_value); | 635 args.SetAt(0, argument_value); |
| 636 args.SetAt(1, Integer::Handle(Integer::New(expected_from))); | 636 args.SetAt(1, Integer::Handle(Integer::New(expected_from))); |
| 637 args.SetAt(2, Integer::Handle(Integer::New(expected_to))); | 637 args.SetAt(2, Integer::Handle(Integer::New(expected_to))); |
| 638 args.SetAt(3, String::Handle(String::New(argument_name))); | 638 args.SetAt(3, String::Handle(String::New(argument_name))); |
| 639 Exceptions::ThrowByType(Exceptions::kRange, args); | 639 Exceptions::ThrowByType(Exceptions::kRange, args); |
| 640 } | 640 } |
| 641 | 641 |
| 642 | 642 |
| 643 void Exceptions::ThrowCompileTimeError(const LanguageError& error) { |
| 644 const Array& args = Array::Handle(Array::New(1)); |
| 645 args.SetAt(0, String::Handle(error.FormatMessage())); |
| 646 Exceptions::ThrowByType(Exceptions::kCompileTimeError, args); |
| 647 } |
| 648 |
| 649 |
| 643 RawObject* Exceptions::Create(ExceptionType type, const Array& arguments) { | 650 RawObject* Exceptions::Create(ExceptionType type, const Array& arguments) { |
| 644 Library& library = Library::Handle(); | 651 Library& library = Library::Handle(); |
| 645 const String* class_name = NULL; | 652 const String* class_name = NULL; |
| 646 const String* constructor_name = &Symbols::Dot(); | 653 const String* constructor_name = &Symbols::Dot(); |
| 647 switch (type) { | 654 switch (type) { |
| 648 case kNone: | 655 case kNone: |
| 649 case kStackOverflow: | 656 case kStackOverflow: |
| 650 case kOutOfMemory: | 657 case kOutOfMemory: |
| 651 UNREACHABLE(); | 658 UNREACHABLE(); |
| 652 break; | 659 break; |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 706 constructor_name = &Symbols::DotCreate(); | 713 constructor_name = &Symbols::DotCreate(); |
| 707 break; | 714 break; |
| 708 case kAbstractClassInstantiation: | 715 case kAbstractClassInstantiation: |
| 709 library = Library::CoreLibrary(); | 716 library = Library::CoreLibrary(); |
| 710 class_name = &Symbols::AbstractClassInstantiationError(); | 717 class_name = &Symbols::AbstractClassInstantiationError(); |
| 711 constructor_name = &Symbols::DotCreate(); | 718 constructor_name = &Symbols::DotCreate(); |
| 712 break; | 719 break; |
| 713 case kCyclicInitializationError: | 720 case kCyclicInitializationError: |
| 714 library = Library::CoreLibrary(); | 721 library = Library::CoreLibrary(); |
| 715 class_name = &Symbols::CyclicInitializationError(); | 722 class_name = &Symbols::CyclicInitializationError(); |
| 723 break; |
| 724 case kCompileTimeError: |
| 725 library = Library::CoreLibrary(); |
| 726 class_name = &Symbols::_CompileTimeError(); |
| 727 break; |
| 716 } | 728 } |
| 717 | 729 |
| 718 return DartLibraryCalls::InstanceCreate(library, | 730 return DartLibraryCalls::InstanceCreate(library, |
| 719 *class_name, | 731 *class_name, |
| 720 *constructor_name, | 732 *constructor_name, |
| 721 arguments); | 733 arguments); |
| 722 } | 734 } |
| 723 | 735 |
| 724 | 736 |
| 725 } // namespace dart | 737 } // namespace dart |
| OLD | NEW |