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_position.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(TokenPosition 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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
88 | 89 |
89 static void PrintStackTraceAndAbort(const char* reason); | 90 static void PrintStackTraceAndAbort(const char* reason); |
90 | 91 |
91 private: | 92 private: |
92 DISALLOW_COPY_AND_ASSIGN(Exceptions); | 93 DISALLOW_COPY_AND_ASSIGN(Exceptions); |
93 }; | 94 }; |
94 | 95 |
95 } // namespace dart | 96 } // namespace dart |
96 | 97 |
97 #endif // VM_EXCEPTIONS_H_ | 98 #endif // VM_EXCEPTIONS_H_ |
OLD | NEW |