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 #include "vm/token_position.h" |
10 | 10 |
11 namespace dart { | 11 namespace dart { |
12 | 12 |
13 // Forward declarations. | 13 // Forward declarations. |
14 class AbstractType; | 14 class AbstractType; |
15 class Array; | 15 class Array; |
16 class DartFrameIterator; | 16 class DartFrameIterator; |
17 class Error; | 17 class Error; |
| 18 class LanguageError; |
18 class Instance; | 19 class Instance; |
19 class Integer; | 20 class Integer; |
20 class RawInstance; | 21 class RawInstance; |
21 class RawObject; | 22 class RawObject; |
22 class RawScript; | 23 class RawScript; |
23 class RawStacktrace; | 24 class RawStacktrace; |
24 class String; | 25 class String; |
25 class Thread; | 26 class Thread; |
26 | 27 |
27 class Exceptions : AllStatic { | 28 class Exceptions : AllStatic { |
(...skipping 25 matching lines...) Expand all Loading... |
53 kStackOverflow, | 54 kStackOverflow, |
54 kOutOfMemory, | 55 kOutOfMemory, |
55 kNullThrown, | 56 kNullThrown, |
56 kIsolateSpawn, | 57 kIsolateSpawn, |
57 kAssertion, | 58 kAssertion, |
58 kCast, | 59 kCast, |
59 kType, | 60 kType, |
60 kFallThrough, | 61 kFallThrough, |
61 kAbstractClassInstantiation, | 62 kAbstractClassInstantiation, |
62 kCyclicInitializationError, | 63 kCyclicInitializationError, |
| 64 kCompileTimeError, |
63 }; | 65 }; |
64 | 66 |
65 static void ThrowByType(ExceptionType type, const Array& arguments); | 67 static void ThrowByType(ExceptionType type, const Array& arguments); |
66 // Uses the preallocated out of memory exception to avoid calling | 68 // Uses the preallocated out of memory exception to avoid calling |
67 // into Dart code or allocating any code. | 69 // into Dart code or allocating any code. |
68 static void ThrowOOM(); | 70 static void ThrowOOM(); |
69 static void ThrowStackOverflow(); | 71 static void ThrowStackOverflow(); |
70 static void ThrowArgumentError(const Instance& arg); | 72 static void ThrowArgumentError(const Instance& arg); |
71 static void ThrowRangeError(const char* argument_name, | 73 static void ThrowRangeError(const char* argument_name, |
72 const Integer& argument_value, | 74 const Integer& argument_value, |
73 intptr_t expected_from, | 75 intptr_t expected_from, |
74 intptr_t expected_to); | 76 intptr_t expected_to); |
| 77 static void ThrowCompileTimeError(const LanguageError& error); |
75 | 78 |
76 // Returns a RawInstance if the exception is successfully created, | 79 // Returns a RawInstance if the exception is successfully created, |
77 // otherwise returns a RawError. | 80 // otherwise returns a RawError. |
78 static RawObject* Create(ExceptionType type, const Array& arguments); | 81 static RawObject* Create(ExceptionType type, const Array& arguments); |
79 | 82 |
80 private: | 83 private: |
81 DISALLOW_COPY_AND_ASSIGN(Exceptions); | 84 DISALLOW_COPY_AND_ASSIGN(Exceptions); |
82 }; | 85 }; |
83 | 86 |
84 } // namespace dart | 87 } // namespace dart |
85 | 88 |
86 #endif // VM_EXCEPTIONS_H_ | 89 #endif // VM_EXCEPTIONS_H_ |
OLD | NEW |