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 408 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
419 // No ambiguity error expected: passing NULL. | 419 // No ambiguity error expected: passing NULL. |
420 Class& cls = Class::Handle(core_lib.LookupClass(cls_name)); | 420 Class& cls = Class::Handle(core_lib.LookupClass(cls_name)); |
421 ASSERT(!cls.IsNull()); | 421 ASSERT(!cls.IsNull()); |
422 // There are no parameterized error types, so no need to set type arguments. | 422 // There are no parameterized error types, so no need to set type arguments. |
423 return Instance::New(cls); | 423 return Instance::New(cls); |
424 } | 424 } |
425 | 425 |
426 | 426 |
427 // Allocate, initialize, and throw a TypeError or CastError. | 427 // Allocate, initialize, and throw a TypeError or CastError. |
428 // If error_msg is not null, throw a TypeError, even for a type cast. | 428 // If error_msg is not null, throw a TypeError, even for a type cast. |
429 void Exceptions::CreateAndThrowTypeError(intptr_t location, | 429 void Exceptions::CreateAndThrowTypeError(TokenPosition location, |
430 const String& src_type_name, | 430 const String& src_type_name, |
431 const String& dst_type_name, | 431 const String& dst_type_name, |
432 const String& dst_name, | 432 const String& dst_name, |
433 const String& error_msg) { | 433 const String& error_msg) { |
434 const Array& args = Array::Handle(Array::New(7)); | 434 const Array& args = Array::Handle(Array::New(7)); |
435 | 435 |
436 ExceptionType exception_type = | 436 ExceptionType exception_type = |
437 (error_msg.IsNull() && dst_name.Equals(kCastErrorDstName)) ? | 437 (error_msg.IsNull() && dst_name.Equals(kCastErrorDstName)) ? |
438 kCast : kType; | 438 kCast : kType; |
439 | 439 |
(...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
688 void Exceptions::PrintStackTraceAndAbort(const char* reason) { | 688 void Exceptions::PrintStackTraceAndAbort(const char* reason) { |
689 const Instance& stacktrace = Instance::Handle(CurrentStacktrace()); | 689 const Instance& stacktrace = Instance::Handle(CurrentStacktrace()); |
690 | 690 |
691 OS::PrintErr("\n\n\nAborting due to %s. Stacktrace:\n%s\n", | 691 OS::PrintErr("\n\n\nAborting due to %s. Stacktrace:\n%s\n", |
692 reason, | 692 reason, |
693 stacktrace.ToCString()); | 693 stacktrace.ToCString()); |
694 OS::Abort(); | 694 OS::Abort(); |
695 } | 695 } |
696 | 696 |
697 } // namespace dart | 697 } // namespace dart |
OLD | NEW |