Chromium Code Reviews| 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::ThrowSyntaxError(const LanguageError& error) { | |
| 644 const Array& args = Array::Handle(Array::New(1)); | |
| 645 args.SetAt(0, String::Handle(error.FormatMessage())); | |
| 646 Exceptions::ThrowByType(Exceptions::kSyntaxError, 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 kSyntaxError: | |
| 725 library = Library::CoreLibrary(); | |
| 726 class_name = &Symbols::SyntaxError(); | |
|
siva
2016/09/15 18:11:45
Does this need to be
break;
default:
UNREACHA
hausner
2016/09/15 21:28:28
Done.
There does not seem to be a default case, t
| |
| 716 } | 727 } |
| 717 | 728 |
| 718 return DartLibraryCalls::InstanceCreate(library, | 729 return DartLibraryCalls::InstanceCreate(library, |
| 719 *class_name, | 730 *class_name, |
| 720 *constructor_name, | 731 *constructor_name, |
| 721 arguments); | 732 arguments); |
| 722 } | 733 } |
| 723 | 734 |
| 724 | 735 |
| 725 } // namespace dart | 736 } // namespace dart |
| OLD | NEW |