aboutsummaryrefslogtreecommitdiff
path: root/deps/v8/src/pending-compilation-error-handler.h
diff options
context:
space:
mode:
authorMichaƫl Zasso <targos@protonmail.com>2018-01-24 20:16:06 +0100
committerMyles Borins <mylesborins@google.com>2018-01-24 15:02:20 -0800
commit4c4af643e5042d615a60c6bbc05aee9d81b903e5 (patch)
tree3fb0a97988fe4439ae3ae06f26915d1dcf8cab92 /deps/v8/src/pending-compilation-error-handler.h
parentfa9f31a4fda5a3782c652e56e394465805ebb50f (diff)
downloadandroid-node-v8-4c4af643e5042d615a60c6bbc05aee9d81b903e5.tar.gz
android-node-v8-4c4af643e5042d615a60c6bbc05aee9d81b903e5.tar.bz2
android-node-v8-4c4af643e5042d615a60c6bbc05aee9d81b903e5.zip
deps: update V8 to 6.4.388.40
PR-URL: https://github.com/nodejs/node/pull/17489 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Myles Borins <myles.borins@gmail.com> Reviewed-By: Ali Ijaz Sheikh <ofrobots@google.com>
Diffstat (limited to 'deps/v8/src/pending-compilation-error-handler.h')
-rw-r--r--deps/v8/src/pending-compilation-error-handler.h91
1 files changed, 60 insertions, 31 deletions
diff --git a/deps/v8/src/pending-compilation-error-handler.h b/deps/v8/src/pending-compilation-error-handler.h
index 42c679e75c..b828fff17c 100644
--- a/deps/v8/src/pending-compilation-error-handler.h
+++ b/deps/v8/src/pending-compilation-error-handler.h
@@ -5,6 +5,8 @@
#ifndef V8_PENDING_COMPILATION_ERROR_HANDLER_H_
#define V8_PENDING_COMPILATION_ERROR_HANDLER_H_
+#include <forward_list>
+
#include "src/base/macros.h"
#include "src/globals.h"
#include "src/handles.h"
@@ -14,6 +16,7 @@ namespace v8 {
namespace internal {
class AstRawString;
+class AstValueFactory;
class Isolate;
class Script;
@@ -23,57 +26,83 @@ class PendingCompilationErrorHandler {
public:
PendingCompilationErrorHandler()
: has_pending_error_(false),
- start_position_(-1),
- end_position_(-1),
- message_(MessageTemplate::kNone),
- arg_(nullptr),
- char_arg_(nullptr),
+ stack_overflow_(false),
error_type_(kSyntaxError) {}
void ReportMessageAt(int start_position, int end_position,
MessageTemplate::Template message,
const char* arg = nullptr,
- ParseErrorType error_type = kSyntaxError) {
- if (has_pending_error_) return;
- has_pending_error_ = true;
- start_position_ = start_position;
- end_position_ = end_position;
- message_ = message;
- char_arg_ = arg;
- arg_ = nullptr;
- error_type_ = error_type;
- }
+ ParseErrorType error_type = kSyntaxError);
void ReportMessageAt(int start_position, int end_position,
MessageTemplate::Template message,
const AstRawString* arg,
- ParseErrorType error_type = kSyntaxError) {
- if (has_pending_error_) return;
+ ParseErrorType error_type = kSyntaxError);
+
+ void ReportWarningAt(int start_position, int end_position,
+ MessageTemplate::Template message,
+ const char* arg = nullptr);
+
+ bool stack_overflow() const { return stack_overflow_; }
+
+ void set_stack_overflow() {
has_pending_error_ = true;
- start_position_ = start_position;
- end_position_ = end_position;
- message_ = message;
- char_arg_ = nullptr;
- arg_ = arg;
- error_type_ = error_type;
+ stack_overflow_ = true;
}
bool has_pending_error() const { return has_pending_error_; }
+ bool has_pending_warnings() const { return !warning_messages_.empty(); }
- void ThrowPendingError(Isolate* isolate, Handle<Script> script);
- Handle<String> FormatMessage(Isolate* isolate);
+ // Handle errors detected during parsing.
+ void ReportErrors(Isolate* isolate, Handle<Script> script,
+ AstValueFactory* ast_value_factory);
+
+ // Handle warnings detected during compilation.
+ void ReportWarnings(Isolate* isolate, Handle<Script> script);
+
+ Handle<String> FormatErrorMessageForTest(Isolate* isolate) const;
private:
- Handle<String> ArgumentString(Isolate* isolate);
+ class MessageDetails {
+ public:
+ MOVE_ONLY_NO_DEFAULT_CONSTRUCTOR(MessageDetails);
+ MessageDetails()
+ : start_position_(-1),
+ end_position_(-1),
+ message_(MessageTemplate::kNone),
+ arg_(nullptr),
+ char_arg_(nullptr) {}
+ MessageDetails(int start_position, int end_position,
+ MessageTemplate::Template message, const AstRawString* arg,
+ const char* char_arg)
+ : start_position_(start_position),
+ end_position_(end_position),
+ message_(message),
+ arg_(arg),
+ char_arg_(char_arg) {}
+
+ Handle<String> ArgumentString(Isolate* isolate) const;
+ MessageLocation GetLocation(Handle<Script> script) const;
+ MessageTemplate::Template message() const { return message_; }
+
+ private:
+ int start_position_;
+ int end_position_;
+ MessageTemplate::Template message_;
+ const AstRawString* arg_;
+ const char* char_arg_;
+ };
+
+ void ThrowPendingError(Isolate* isolate, Handle<Script> script);
bool has_pending_error_;
- int start_position_;
- int end_position_;
- MessageTemplate::Template message_;
- const AstRawString* arg_;
- const char* char_arg_;
+ bool stack_overflow_;
+
+ MessageDetails error_details_;
ParseErrorType error_type_;
+ std::forward_list<MessageDetails> warning_messages_;
+
DISALLOW_COPY_AND_ASSIGN(PendingCompilationErrorHandler);
};