Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(335)

Unified Diff: src/parsing/preparse-data.h

Issue 2502633002: [parser] Only log messages using the pending error handling (Closed)
Patch Set: Delete more unused code Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: src/parsing/preparse-data.h
diff --git a/src/parsing/preparse-data.h b/src/parsing/preparse-data.h
index 364d123a0d01709cf37441c32fc98010327d30ca..767484ad7ff074bc9fecd7625d7c32543f852d06 100644
--- a/src/parsing/preparse-data.h
+++ b/src/parsing/preparse-data.h
@@ -49,18 +49,14 @@ class ScriptData {
class PreParserLogger final {
public:
PreParserLogger()
- : has_error_(false),
- start_(-1),
- end_(-1),
+ : end_(-1),
num_parameters_(-1),
function_length_(-1),
- has_duplicate_parameters_(false),
- error_type_(kSyntaxError) {}
+ has_duplicate_parameters_(false) {}
void LogFunction(int end, int num_parameters, int function_length,
bool has_duplicate_parameters, int literals,
int properties) {
- DCHECK(!has_error_);
end_ = end;
num_parameters_ = num_parameters;
function_length_ = function_length;
@@ -69,60 +65,24 @@ class PreParserLogger final {
properties_ = properties;
}
- // Logs an error message and marks the log as containing an error.
- // Further logging will be ignored, and ExtractData will return a vector
- // representing the error only.
- void LogMessage(int start, int end, MessageTemplate::Template message,
- const char* argument_opt, ParseErrorType error_type) {
- if (has_error_) return;
- has_error_ = true;
- start_ = start;
- end_ = end;
- message_ = message;
- argument_opt_ = argument_opt;
- error_type_ = error_type;
- }
-
- bool has_error() const { return has_error_; }
-
- int start() const { return start_; }
int end() const { return end_; }
int num_parameters() const {
- DCHECK(!has_error_);
return num_parameters_;
}
int function_length() const {
- DCHECK(!has_error_);
return function_length_;
}
bool has_duplicate_parameters() const {
- DCHECK(!has_error_);
return has_duplicate_parameters_;
}
int literals() const {
- DCHECK(!has_error_);
return literals_;
}
int properties() const {
- DCHECK(!has_error_);
return properties_;
}
- ParseErrorType error_type() const {
- DCHECK(has_error_);
- return error_type_;
- }
- MessageTemplate::Template message() {
- DCHECK(has_error_);
- return message_;
- }
- const char* argument_opt() const {
- DCHECK(has_error_);
- return argument_opt_;
- }
private:
- bool has_error_;
- int start_;
int end_;
// For function entries.
int num_parameters_;
@@ -130,19 +90,10 @@ class PreParserLogger final {
bool has_duplicate_parameters_;
int literals_;
int properties_;
- // For error messages.
- MessageTemplate::Template message_;
- const char* argument_opt_;
- ParseErrorType error_type_;
};
class ParserLogger final {
public:
- struct Key {
- bool is_one_byte;
- Vector<const byte> literal_bytes;
- };
-
ParserLogger();
void LogFunction(int start, int end, int num_parameters, int function_length,
@@ -150,24 +101,9 @@ class ParserLogger final {
LanguageMode language_mode, bool uses_super_property,
bool calls_eval);
- // Logs an error message and marks the log as containing an error.
- // Further logging will be ignored, and ExtractData will return a vector
- // representing the error only.
- void LogMessage(int start, int end, MessageTemplate::Template message,
- const char* argument_opt, ParseErrorType error_type);
ScriptData* GetScriptData();
- bool HasError() {
- return static_cast<bool>(preamble_[PreparseDataConstants::kHasErrorOffset]);
- }
- Vector<unsigned> ErrorMessageData() {
- DCHECK(HasError());
- return function_store_.ToVector();
- }
-
private:
- void WriteString(Vector<const char> str);
-
Collector<unsigned> function_store_;
unsigned preamble_[PreparseDataConstants::kHeaderSize];

Powered by Google App Engine
This is Rietveld 408576698