| 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 "vm/dart_api_impl.h" | 7 #include "vm/dart_api_impl.h" |
| 8 #include "vm/dart_entry.h" | 8 #include "vm/dart_entry.h" |
| 9 #include "vm/debugger.h" | 9 #include "vm/debugger.h" |
| 10 #include "vm/flags.h" | 10 #include "vm/flags.h" |
| (...skipping 406 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 417 } else { | 417 } else { |
| 418 ASSERT(result.IsInstance()); | 418 ASSERT(result.IsInstance()); |
| 419 Throw(Instance::Cast(result)); | 419 Throw(Instance::Cast(result)); |
| 420 } | 420 } |
| 421 } | 421 } |
| 422 | 422 |
| 423 | 423 |
| 424 RawObject* Exceptions::Create(ExceptionType type, const Array& arguments) { | 424 RawObject* Exceptions::Create(ExceptionType type, const Array& arguments) { |
| 425 Library& library = Library::Handle(); | 425 Library& library = Library::Handle(); |
| 426 const String* class_name = NULL; | 426 const String* class_name = NULL; |
| 427 const String* constructor_name = &Symbols::Dot(); |
| 427 switch (type) { | 428 switch (type) { |
| 428 case kNone: | 429 case kNone: |
| 429 UNREACHABLE(); | 430 UNREACHABLE(); |
| 430 break; | 431 break; |
| 431 case kRange: | 432 case kRange: |
| 432 library = Library::CoreLibrary(); | 433 library = Library::CoreLibrary(); |
| 433 class_name = &Symbols::RangeError(); | 434 class_name = &Symbols::RangeError(); |
| 434 break; | 435 break; |
| 435 case kArgument: | 436 case kArgument: |
| 436 library = Library::CoreLibrary(); | 437 library = Library::CoreLibrary(); |
| 437 class_name = &Symbols::ArgumentError(); | 438 class_name = &Symbols::ArgumentError(); |
| 438 break; | 439 break; |
| 439 case kNoSuchMethod: | 440 case kNoSuchMethod: |
| 440 library = Library::CoreLibrary(); | 441 library = Library::CoreLibrary(); |
| 441 class_name = &Symbols::NoSuchMethodError(); | 442 class_name = &Symbols::NoSuchMethodError(); |
| 443 constructor_name = &String::Handle(Symbols::New("._withType")); |
| 442 break; | 444 break; |
| 443 case kFormat: | 445 case kFormat: |
| 444 library = Library::CoreLibrary(); | 446 library = Library::CoreLibrary(); |
| 445 class_name = &Symbols::FormatException(); | 447 class_name = &Symbols::FormatException(); |
| 446 break; | 448 break; |
| 447 case kUnsupported: | 449 case kUnsupported: |
| 448 library = Library::CoreLibrary(); | 450 library = Library::CoreLibrary(); |
| 449 class_name = &Symbols::UnsupportedError(); | 451 class_name = &Symbols::UnsupportedError(); |
| 450 break; | 452 break; |
| 451 case kStackOverflow: | 453 case kStackOverflow: |
| (...skipping 19 matching lines...) Expand all Loading... |
| 471 case kIsolateSpawn: | 473 case kIsolateSpawn: |
| 472 library = Library::IsolateLibrary(); | 474 library = Library::IsolateLibrary(); |
| 473 class_name = &Symbols::IsolateSpawnException(); | 475 class_name = &Symbols::IsolateSpawnException(); |
| 474 break; | 476 break; |
| 475 case kIsolateUnhandledException: | 477 case kIsolateUnhandledException: |
| 476 library = Library::IsolateLibrary(); | 478 library = Library::IsolateLibrary(); |
| 477 class_name = &Symbols::IsolateUnhandledException(); | 479 class_name = &Symbols::IsolateUnhandledException(); |
| 478 break; | 480 break; |
| 479 } | 481 } |
| 480 | 482 |
| 481 return DartLibraryCalls::ExceptionCreate(library, *class_name, arguments); | 483 return DartLibraryCalls::ExceptionCreate(library, |
| 484 *class_name, |
| 485 *constructor_name, |
| 486 arguments); |
| 482 } | 487 } |
| 483 | 488 |
| 484 } // namespace dart | 489 } // namespace dart |
| OLD | NEW |