Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 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 | |
| 3 // BSD-style license that can be found in the LICENSE file. | |
| 4 | |
| 5 #ifndef VM_REPORT_H_ | |
| 6 #define VM_REPORT_H_ | |
| 7 | |
| 8 #include "vm/allocation.h" | |
| 9 | |
| 10 namespace dart { | |
| 11 | |
| 12 // Forward declarations. | |
| 13 class Error; | |
| 14 class ICData; | |
| 15 class RawString; | |
| 16 class Script; | |
| 17 class StackFrame; | |
| 18 class String; | |
| 19 | |
| 20 class Report : AllStatic { | |
| 21 public: | |
| 22 enum Kind { | |
| 23 kWarning, | |
| 24 kJSWarning, | |
| 25 kError, | |
| 26 kMalformedType, | |
| 27 kMalboundedType, | |
| 28 kBailout, | |
| 29 }; | |
| 30 | |
| 31 // Report an already formatted error via a long jump. | |
| 32 static void LongJump(const Error& error); | |
| 33 | |
| 34 // Concatenate and report and already formatted error and a new error message. | |
|
hausner
2014/06/18 21:48:53
an already formatted ...
regis
2014/06/18 22:13:28
Done.
| |
| 35 static void LongJumpF(const Error& error, | |
| 36 const Script& script, intptr_t token_pos, | |
| 37 const char* format, ...) PRINTF_ATTRIBUTE(4, 5); | |
| 38 static void LongJumpV(const Error& error, | |
| 39 const Script& script, intptr_t token_pos, | |
| 40 const char* format, va_list args); | |
| 41 | |
| 42 // Report a warning/jswarning/error/bailout message. | |
| 43 static void MessageF(Kind kind, const Script& script, intptr_t token_pos, | |
| 44 const char* format, ...) PRINTF_ATTRIBUTE(4, 5); | |
| 45 static void MessageV(Kind kind, const Script& script, intptr_t token_pos, | |
| 46 const char* format, va_list args); | |
| 47 | |
| 48 // Support to report Javascript compatibility warnings. Note that a | |
| 49 // JavascriptCompatibilityError is thrown if --warning_as_error is specified. | |
| 50 // If a warning is issued by the various JSWarning calls, the warning is also | |
| 51 // emitted in the trace buffer of the current isolate. | |
| 52 | |
| 53 // Report a Javascript compatibility warning at the call site given by | |
| 54 // ic_data, unless one has already been emitted at that location. | |
| 55 static void JSWarningFromIC(const ICData& ic_data, const char* msg); | |
| 56 | |
| 57 // Report a Javascript compatibility warning at the current native call, | |
| 58 // unless one has already been emitted at that location. | |
| 59 static void JSWarningFromNative(bool is_static_native, const char* msg); | |
| 60 | |
| 61 // Report a Javascript compatibility warning at the call site given by | |
| 62 // caller_frame. | |
| 63 static void JSWarningFromFrame(StackFrame* caller_frame, const char* msg); | |
| 64 | |
| 65 // Prepend a source snippet to the message. | |
| 66 // A null script means no source and a negative token_pos means no position. | |
| 67 static RawString* PrependSnippet(Kind kind, | |
| 68 const Script& script, | |
| 69 intptr_t token_pos, | |
| 70 const String& message); | |
| 71 | |
| 72 private: | |
| 73 // Emit a Javascript compatibility warning to the current trace buffer. | |
| 74 static void TraceJSWarning(const Script& script, | |
| 75 intptr_t token_pos, | |
| 76 const String& message); | |
| 77 | |
| 78 DISALLOW_COPY_AND_ASSIGN(Report); | |
| 79 }; | |
| 80 | |
| 81 } // namespace dart | |
| 82 | |
| 83 #endif // VM_REPORT_H_ | |
| OLD | NEW |