| 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 | 9 |
| 10 namespace dart { | 10 namespace dart { |
| 11 | 11 |
| 12 // Forward declarations. | 12 // Forward declarations. |
| 13 class Array; | 13 class Array; |
| 14 class Class; | 14 class Class; |
| 15 class DartFrameIterator; | 15 class DartFrameIterator; |
| 16 class Error; | 16 class Error; |
| 17 class Instance; | 17 class Instance; |
| 18 class Integer; | 18 class Integer; |
| 19 class Object; | 19 class Object; |
| 20 class RawInstance; | 20 class RawInstance; |
| 21 class RawObject; | 21 class RawObject; |
| 22 class RawScript; | 22 class RawScript; |
| 23 class RawStacktrace; | 23 class RawStacktrace; |
| 24 class RawString; | 24 class RawString; |
| 25 class Script; | 25 class Script; |
| 26 class StackFrame; | 26 class StackFrame; |
| 27 class Stacktrace; |
| 27 class String; | 28 class String; |
| 28 | 29 |
| 29 class Exceptions : AllStatic { | 30 class Exceptions : AllStatic { |
| 30 public: | 31 public: |
| 31 static const char* kCastErrorDstName; | 32 static const char* kCastErrorDstName; |
| 32 | 33 |
| 33 static void Throw(Isolate* isolate, const Instance& exception); | 34 static void Throw(Isolate* isolate, const Instance& exception); |
| 34 static void ReThrow(Isolate* isolate, | 35 static void ReThrow(Isolate* isolate, |
| 35 const Instance& exception, | 36 const Instance& exception, |
| 36 const Instance& stacktrace); | 37 const Stacktrace& stacktrace); |
| 37 static void PropagateError(const Error& error); | 38 static void PropagateError(const Error& error); |
| 38 | 39 |
| 39 // Helpers to create and throw errors. | 40 // Helpers to create and throw errors. |
| 40 static RawStacktrace* CurrentStacktrace(); | 41 static RawStacktrace* CurrentStacktrace(); |
| 41 static RawScript* GetCallerScript(DartFrameIterator* iterator); | 42 static RawScript* GetCallerScript(DartFrameIterator* iterator); |
| 42 static RawInstance* NewInstance(const char* class_name); | 43 static RawInstance* NewInstance(const char* class_name); |
| 43 static void CreateAndThrowTypeError(intptr_t location, | 44 static void CreateAndThrowTypeError(intptr_t location, |
| 44 const String& src_type_name, | 45 const String& src_type_name, |
| 45 const String& dst_type_name, | 46 const String& dst_type_name, |
| 46 const String& dst_name, | 47 const String& dst_name, |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 82 // otherwise returns a RawError. | 83 // otherwise returns a RawError. |
| 83 static RawObject* Create(ExceptionType type, const Array& arguments); | 84 static RawObject* Create(ExceptionType type, const Array& arguments); |
| 84 | 85 |
| 85 private: | 86 private: |
| 86 DISALLOW_COPY_AND_ASSIGN(Exceptions); | 87 DISALLOW_COPY_AND_ASSIGN(Exceptions); |
| 87 }; | 88 }; |
| 88 | 89 |
| 89 } // namespace dart | 90 } // namespace dart |
| 90 | 91 |
| 91 #endif // VM_EXCEPTIONS_H_ | 92 #endif // VM_EXCEPTIONS_H_ |
| OLD | NEW |