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