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

Unified Diff: src/preparse-data.h

Issue 939303002: Replace is_reference_error bool argument with ParseErrorType enum (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Marja comments addressed Created 5 years, 10 months 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
« no previous file with comments | « src/parser.cc ('k') | src/preparse-data.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/preparse-data.h
diff --git a/src/preparse-data.h b/src/preparse-data.h
index 0d784991c2a3e9024bdb9876a58b7dbba5ed0e06..e216cffd8268224d3c192b2101e03ffcf167d5c5 100644
--- a/src/preparse-data.h
+++ b/src/preparse-data.h
@@ -30,11 +30,10 @@ class ParserRecorder {
// 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.
- virtual void LogMessage(int start,
- int end,
- const char* message,
+ virtual void LogMessage(int start, int end, const char* message,
const char* argument_opt,
- bool is_reference_error) = 0;
+ ParseErrorType error_type) = 0;
+
private:
DISALLOW_COPY_AND_ASSIGN(ParserRecorder);
};
@@ -43,7 +42,7 @@ class ParserRecorder {
class SingletonLogger : public ParserRecorder {
public:
SingletonLogger()
- : has_error_(false), start_(-1), end_(-1), is_reference_error_(false) {}
+ : has_error_(false), start_(-1), end_(-1), error_type_(kSyntaxError) {}
virtual ~SingletonLogger() {}
void Reset() { has_error_ = false; }
@@ -63,18 +62,15 @@ class SingletonLogger : public ParserRecorder {
// 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.
- virtual void LogMessage(int start,
- int end,
- const char* message,
- const char* argument_opt,
- bool is_reference_error) {
+ virtual void LogMessage(int start, int end, const char* 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;
- is_reference_error_ = is_reference_error;
+ error_type_ = error_type;
}
bool has_error() const { return has_error_; }
@@ -97,7 +93,10 @@ class SingletonLogger : public ParserRecorder {
DCHECK(!has_error_);
return scope_uses_super_property_;
}
- int is_reference_error() const { return is_reference_error_; }
+ ParseErrorType error_type() const {
+ DCHECK(has_error_);
+ return error_type_;
+ }
const char* message() {
DCHECK(has_error_);
return message_;
@@ -119,7 +118,7 @@ class SingletonLogger : public ParserRecorder {
// For error messages.
const char* message_;
const char* argument_opt_;
- bool is_reference_error_;
+ ParseErrorType error_type_;
};
@@ -147,11 +146,8 @@ class CompleteParserRecorder : public ParserRecorder {
// 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.
- virtual void LogMessage(int start,
- int end,
- const char* message,
- const char* argument_opt,
- bool is_reference_error_);
+ virtual void LogMessage(int start, int end, const char* message,
+ const char* argument_opt, ParseErrorType error_type);
ScriptData* GetScriptData();
bool HasError() {
« no previous file with comments | « src/parser.cc ('k') | src/preparse-data.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698