| OLD | NEW |
| 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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_REPORT_H_ | 5 #ifndef VM_REPORT_H_ |
| 6 #define VM_REPORT_H_ | 6 #define VM_REPORT_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 Error; | 14 class Error; |
| 14 class ICData; | 15 class ICData; |
| 15 class RawString; | 16 class RawString; |
| 16 class Script; | 17 class Script; |
| 17 class StackFrame; | 18 class StackFrame; |
| 18 class String; | 19 class String; |
| (...skipping 10 matching lines...) Expand all Loading... |
| 29 }; | 30 }; |
| 30 | 31 |
| 31 static const bool AtLocation = false; | 32 static const bool AtLocation = false; |
| 32 static const bool AfterLocation = true; | 33 static const bool AfterLocation = true; |
| 33 | 34 |
| 34 // Report an already formatted error via a long jump. | 35 // Report an already formatted error via a long jump. |
| 35 static void LongJump(const Error& error); | 36 static void LongJump(const Error& error); |
| 36 | 37 |
| 37 // Concatenate and report an already formatted error and a new error message. | 38 // Concatenate and report an already formatted error and a new error message. |
| 38 static void LongJumpF(const Error& prev_error, | 39 static void LongJumpF(const Error& prev_error, |
| 39 const Script& script, intptr_t token_pos, | 40 const Script& script, TokenPosition token_pos, |
| 40 const char* format, ...) PRINTF_ATTRIBUTE(4, 5); | 41 const char* format, ...) PRINTF_ATTRIBUTE(4, 5); |
| 41 static void LongJumpV(const Error& prev_error, | 42 static void LongJumpV(const Error& prev_error, |
| 42 const Script& script, intptr_t token_pos, | 43 const Script& script, TokenPosition token_pos, |
| 43 const char* format, va_list args); | 44 const char* format, va_list args); |
| 44 | 45 |
| 45 // Report a warning/jswarning/error/bailout message. | 46 // Report a warning/jswarning/error/bailout message. |
| 46 static void MessageF(Kind kind, const Script& script, intptr_t token_pos, | 47 static void MessageF(Kind kind, |
| 48 const Script& script, |
| 49 TokenPosition token_pos, |
| 47 bool report_after_token, | 50 bool report_after_token, |
| 48 const char* format, ...) PRINTF_ATTRIBUTE(5, 6); | 51 const char* format, ...) PRINTF_ATTRIBUTE(5, 6); |
| 49 static void MessageV(Kind kind, const Script& script, intptr_t token_pos, | 52 static void MessageV(Kind kind, |
| 53 const Script& script, |
| 54 TokenPosition token_pos, |
| 50 bool report_after_token, | 55 bool report_after_token, |
| 51 const char* format, va_list args); | 56 const char* format, va_list args); |
| 52 | 57 |
| 53 // Support to report Javascript compatibility warnings. Note that a | 58 // Support to report Javascript compatibility warnings. Note that a |
| 54 // JavascriptCompatibilityError is thrown if --warning_as_error is specified. | 59 // JavascriptCompatibilityError is thrown if --warning_as_error is specified. |
| 55 // If a warning is issued by the various JSWarning calls, the warning is also | 60 // If a warning is issued by the various JSWarning calls, the warning is also |
| 56 // emitted in the trace buffer of the current isolate. | 61 // emitted in the trace buffer of the current isolate. |
| 57 | 62 |
| 58 // Report a Javascript compatibility warning at the call site given by | 63 // Report a Javascript compatibility warning at the call site given by |
| 59 // ic_data, unless one has already been emitted at that location. | 64 // ic_data, unless one has already been emitted at that location. |
| 60 static void JSWarningFromIC(const ICData& ic_data, const char* msg); | 65 static void JSWarningFromIC(const ICData& ic_data, const char* msg); |
| 61 | 66 |
| 62 // Report a Javascript compatibility warning at the current native call, | 67 // Report a Javascript compatibility warning at the current native call, |
| 63 // unless one has already been emitted at that location. | 68 // unless one has already been emitted at that location. |
| 64 static void JSWarningFromNative(bool is_static_native, const char* msg); | 69 static void JSWarningFromNative(bool is_static_native, const char* msg); |
| 65 | 70 |
| 66 // Report a Javascript compatibility warning at the call site given by | 71 // Report a Javascript compatibility warning at the call site given by |
| 67 // caller_frame. | 72 // caller_frame. |
| 68 static void JSWarningFromFrame(StackFrame* caller_frame, const char* msg); | 73 static void JSWarningFromFrame(StackFrame* caller_frame, const char* msg); |
| 69 | 74 |
| 70 // Prepend a source snippet to the message. | 75 // Prepend a source snippet to the message. |
| 71 // A null script means no source and a negative token_pos means no position. | 76 // A null script means no source and a negative token_pos means no position. |
| 72 static RawString* PrependSnippet(Kind kind, | 77 static RawString* PrependSnippet(Kind kind, |
| 73 const Script& script, | 78 const Script& script, |
| 74 intptr_t token_pos, | 79 TokenPosition token_pos, |
| 75 bool report_after_token, | 80 bool report_after_token, |
| 76 const String& message); | 81 const String& message); |
| 77 | 82 |
| 78 private: | 83 private: |
| 79 // Emit a Javascript compatibility warning to the current trace buffer. | 84 // Emit a Javascript compatibility warning to the current trace buffer. |
| 80 static void TraceJSWarning(const Script& script, | 85 static void TraceJSWarning(const Script& script, |
| 81 intptr_t token_pos, | 86 TokenPosition token_pos, |
| 82 const String& message); | 87 const String& message); |
| 83 | 88 |
| 84 DISALLOW_COPY_AND_ASSIGN(Report); | 89 DISALLOW_COPY_AND_ASSIGN(Report); |
| 85 }; | 90 }; |
| 86 | 91 |
| 87 } // namespace dart | 92 } // namespace dart |
| 88 | 93 |
| 89 #endif // VM_REPORT_H_ | 94 #endif // VM_REPORT_H_ |
| 90 | 95 |
| OLD | NEW |