| 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 #ifndef VM_EXCEPTIONS_H_ | 5 #ifndef VM_EXCEPTIONS_H_ |
| 6 #define VM_EXCEPTIONS_H_ | 6 #define VM_EXCEPTIONS_H_ |
| 7 | 7 |
| 8 #include "vm/allocation.h" | 8 #include "vm/allocation.h" |
| 9 #include "vm/token_descriptor.h" |
| 9 | 10 |
| 10 namespace dart { | 11 namespace dart { |
| 11 | 12 |
| 12 // Forward declarations. | 13 // Forward declarations. |
| 13 class Array; | 14 class Array; |
| 14 class Class; | 15 class Class; |
| 15 class DartFrameIterator; | 16 class DartFrameIterator; |
| 16 class Error; | 17 class Error; |
| 17 class Instance; | 18 class Instance; |
| 18 class Integer; | 19 class Integer; |
| (...skipping 16 matching lines...) Expand all Loading... |
| 35 static void Throw(Thread* thread, const Instance& exception); | 36 static void Throw(Thread* thread, const Instance& exception); |
| 36 static void ReThrow(Thread* thread, | 37 static void ReThrow(Thread* thread, |
| 37 const Instance& exception, | 38 const Instance& exception, |
| 38 const Instance& stacktrace); | 39 const Instance& stacktrace); |
| 39 static void PropagateError(const Error& error); | 40 static void PropagateError(const Error& error); |
| 40 | 41 |
| 41 // Helpers to create and throw errors. | 42 // Helpers to create and throw errors. |
| 42 static RawStacktrace* CurrentStacktrace(); | 43 static RawStacktrace* CurrentStacktrace(); |
| 43 static RawScript* GetCallerScript(DartFrameIterator* iterator); | 44 static RawScript* GetCallerScript(DartFrameIterator* iterator); |
| 44 static RawInstance* NewInstance(const char* class_name); | 45 static RawInstance* NewInstance(const char* class_name); |
| 45 static void CreateAndThrowTypeError(intptr_t location, | 46 static void CreateAndThrowTypeError(TokenDescriptor location, |
| 46 const String& src_type_name, | 47 const String& src_type_name, |
| 47 const String& dst_type_name, | 48 const String& dst_type_name, |
| 48 const String& dst_name, | 49 const String& dst_name, |
| 49 const String& error_msg); | 50 const String& error_msg); |
| 50 | 51 |
| 51 enum ExceptionType { | 52 enum ExceptionType { |
| 52 kNone, | 53 kNone, |
| 53 kRange, | 54 kRange, |
| 54 kArgument, | 55 kArgument, |
| 55 kArgumentValue, | 56 kArgumentValue, |
| (...skipping 30 matching lines...) Expand all Loading... |
| 86 // otherwise returns a RawError. | 87 // otherwise returns a RawError. |
| 87 static RawObject* Create(ExceptionType type, const Array& arguments); | 88 static RawObject* Create(ExceptionType type, const Array& arguments); |
| 88 | 89 |
| 89 private: | 90 private: |
| 90 DISALLOW_COPY_AND_ASSIGN(Exceptions); | 91 DISALLOW_COPY_AND_ASSIGN(Exceptions); |
| 91 }; | 92 }; |
| 92 | 93 |
| 93 } // namespace dart | 94 } // namespace dart |
| 94 | 95 |
| 95 #endif // VM_EXCEPTIONS_H_ | 96 #endif // VM_EXCEPTIONS_H_ |
| OLD | NEW |