5 #ifndef V8_PENDING_COMPILATION_ERROR_HANDLER_H_ 6 #define V8_PENDING_COMPILATION_ERROR_HANDLER_H_ 8 #include <forward_list> 10 #include "src/base/macros.h" 11 #include "src/globals.h" 12 #include "src/handles.h" 13 #include "src/message-template.h" 19 class AstValueFactory;
28 : has_pending_error_(
false),
29 stack_overflow_(
false),
30 error_type_(kSyntaxError) {}
32 void ReportMessageAt(
int start_position,
int end_position,
33 MessageTemplate message,
const char* arg =
nullptr,
34 ParseErrorType error_type = kSyntaxError);
36 void ReportMessageAt(
int start_position,
int end_position,
38 ParseErrorType error_type = kSyntaxError);
40 void ReportWarningAt(
int start_position,
int end_position,
41 MessageTemplate message,
const char* arg =
nullptr);
43 bool stack_overflow()
const {
return stack_overflow_; }
45 void set_stack_overflow() {
46 has_pending_error_ =
true;
47 stack_overflow_ =
true;
50 bool has_pending_error()
const {
return has_pending_error_; }
51 bool has_pending_warnings()
const {
return !warning_messages_.empty(); }
62 void set_unidentifiable_error() {
63 has_pending_error_ =
true;
64 unidentifiable_error_ =
true;
66 void clear_unidentifiable_error() {
67 has_pending_error_ =
false;
68 unidentifiable_error_ =
false;
70 bool has_error_unidentifiable_by_preparser()
const {
71 return unidentifiable_error_;
75 class MessageDetails {
77 MOVE_ONLY_NO_DEFAULT_CONSTRUCTOR(MessageDetails);
79 : start_position_(-1),
81 message_(MessageTemplate::kNone),
84 MessageDetails(
int start_position,
int end_position,
87 : start_position_(start_position),
88 end_position_(end_position),
91 char_arg_(char_arg) {}
95 MessageTemplate message()
const {
return message_; }
100 MessageTemplate message_;
102 const char* char_arg_;
107 bool has_pending_error_;
108 bool stack_overflow_;
109 bool unidentifiable_error_ =
false;
111 MessageDetails error_details_;
112 ParseErrorType error_type_;
114 std::forward_list<MessageDetails> warning_messages_;
121 #endif // V8_PENDING_COMPILATION_ERROR_HANDLER_H_