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 406 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
417 // No ambiguity error expected: passing NULL. | 417 // No ambiguity error expected: passing NULL. |
418 Class& cls = Class::Handle(core_lib.LookupClass(cls_name)); | 418 Class& cls = Class::Handle(core_lib.LookupClass(cls_name)); |
419 ASSERT(!cls.IsNull()); | 419 ASSERT(!cls.IsNull()); |
420 // There are no parameterized error types, so no need to set type arguments. | 420 // There are no parameterized error types, so no need to set type arguments. |
421 return Instance::New(cls); | 421 return Instance::New(cls); |
422 } | 422 } |
423 | 423 |
424 | 424 |
425 // Allocate, initialize, and throw a TypeError or CastError. | 425 // Allocate, initialize, and throw a TypeError or CastError. |
426 // If error_msg is not null, throw a TypeError, even for a type cast. | 426 // If error_msg is not null, throw a TypeError, even for a type cast. |
427 void Exceptions::CreateAndThrowTypeError(intptr_t location, | 427 void Exceptions::CreateAndThrowTypeError(TokenDescriptor location, |
428 const String& src_type_name, | 428 const String& src_type_name, |
429 const String& dst_type_name, | 429 const String& dst_type_name, |
430 const String& dst_name, | 430 const String& dst_name, |
431 const String& error_msg) { | 431 const String& error_msg) { |
432 const Array& args = Array::Handle(Array::New(7)); | 432 const Array& args = Array::Handle(Array::New(7)); |
433 | 433 |
434 ExceptionType exception_type = | 434 ExceptionType exception_type = |
435 (error_msg.IsNull() && dst_name.Equals(kCastErrorDstName)) ? | 435 (error_msg.IsNull() && dst_name.Equals(kCastErrorDstName)) ? |
436 kCast : kType; | 436 kCast : kType; |
437 | 437 |
(...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
671 | 671 |
672 // Throw JavascriptCompatibilityError exception. | 672 // Throw JavascriptCompatibilityError exception. |
673 void Exceptions::ThrowJavascriptCompatibilityError(const char* msg) { | 673 void Exceptions::ThrowJavascriptCompatibilityError(const char* msg) { |
674 const Array& exc_args = Array::Handle(Array::New(1)); | 674 const Array& exc_args = Array::Handle(Array::New(1)); |
675 const String& msg_str = String::Handle(String::New(msg)); | 675 const String& msg_str = String::Handle(String::New(msg)); |
676 exc_args.SetAt(0, msg_str); | 676 exc_args.SetAt(0, msg_str); |
677 Exceptions::ThrowByType(Exceptions::kJavascriptCompatibilityError, exc_args); | 677 Exceptions::ThrowByType(Exceptions::kJavascriptCompatibilityError, exc_args); |
678 } | 678 } |
679 | 679 |
680 } // namespace dart | 680 } // namespace dart |
OLD | NEW |