| 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/growable_array.h" | 9 #include "vm/growable_array.h" |
| 10 | 10 |
| (...skipping 17 matching lines...) Expand all Loading... |
| 28 public: | 28 public: |
| 29 static const char* kCastErrorDstName; | 29 static const char* kCastErrorDstName; |
| 30 | 30 |
| 31 static void Throw(const Instance& exception); | 31 static void Throw(const Instance& exception); |
| 32 static void ReThrow(const Instance& exception, const Instance& stacktrace); | 32 static void ReThrow(const Instance& exception, const Instance& stacktrace); |
| 33 static void PropagateError(const Error& error); | 33 static void PropagateError(const Error& error); |
| 34 | 34 |
| 35 // Report a Javascript compatibility warning at the call site given by | 35 // Report a Javascript compatibility warning at the call site given by |
| 36 // caller_frame. Note that a JavascriptCompatibilityError is thrown | 36 // caller_frame. Note that a JavascriptCompatibilityError is thrown |
| 37 // if --warning_as_error is specified. | 37 // if --warning_as_error is specified. |
| 38 // Also calls TraceJSWarningV below. |
| 38 static void JSWarning(StackFrame* caller_frame, const char* format, ...) | 39 static void JSWarning(StackFrame* caller_frame, const char* format, ...) |
| 39 PRINTF_ATTRIBUTE(2, 3); | 40 PRINTF_ATTRIBUTE(2, 3); |
| 40 | 41 |
| 42 // Emit a Javascript compatibility warning to the current trace buffer. |
| 43 static void TraceJSWarningF(const Script& script, intptr_t token_pos, |
| 44 const char* format, ...) PRINTF_ATTRIBUTE(3, 4); |
| 45 static void TraceJSWarningV(const Script& script, intptr_t token_pos, |
| 46 const char* format, va_list args); |
| 47 |
| 41 static RawStacktrace* CurrentStacktrace(); | 48 static RawStacktrace* CurrentStacktrace(); |
| 42 | 49 |
| 43 // Helpers to create and throw errors. | 50 // Helpers to create and throw errors. |
| 44 static RawScript* GetCallerScript(DartFrameIterator* iterator); | 51 static RawScript* GetCallerScript(DartFrameIterator* iterator); |
| 45 static RawInstance* NewInstance(const char* class_name); | 52 static RawInstance* NewInstance(const char* class_name); |
| 46 static void CreateAndThrowTypeError(intptr_t location, | 53 static void CreateAndThrowTypeError(intptr_t location, |
| 47 const String& src_type_name, | 54 const String& src_type_name, |
| 48 const String& dst_type_name, | 55 const String& dst_type_name, |
| 49 const String& dst_name, | 56 const String& dst_name, |
| 50 const String& error_msg); | 57 const String& error_msg); |
| (...skipping 30 matching lines...) Expand all Loading... |
| 81 // otherwise returns a RawError. | 88 // otherwise returns a RawError. |
| 82 static RawObject* Create(ExceptionType type, const Array& arguments); | 89 static RawObject* Create(ExceptionType type, const Array& arguments); |
| 83 | 90 |
| 84 private: | 91 private: |
| 85 DISALLOW_COPY_AND_ASSIGN(Exceptions); | 92 DISALLOW_COPY_AND_ASSIGN(Exceptions); |
| 86 }; | 93 }; |
| 87 | 94 |
| 88 } // namespace dart | 95 } // namespace dart |
| 89 | 96 |
| 90 #endif // VM_EXCEPTIONS_H_ | 97 #endif // VM_EXCEPTIONS_H_ |
| OLD | NEW |