Index: src/parsing/preparse-data.h |
diff --git a/src/parsing/preparse-data.h b/src/parsing/preparse-data.h |
index 42ab55cfeae058727cdda44a4d95c46d8e1fd0a6..77e62428cd865ca315ac81e07f2f19b14a9ca3f8 100644 |
--- a/src/parsing/preparse-data.h |
+++ b/src/parsing/preparse-data.h |
@@ -46,32 +46,7 @@ class ScriptData { |
DISALLOW_COPY_AND_ASSIGN(ScriptData); |
}; |
-// Abstract interface for preparse data recorder. |
-class ParserRecorder { |
- public: |
- ParserRecorder() { } |
- virtual ~ParserRecorder() { } |
- |
- // Logs the scope and some details of a function literal in the source. |
- virtual void LogFunction(int start, int end, int num_parameters, |
- int function_length, bool has_duplicate_parameters, |
- int literals, int properties, |
- LanguageMode language_mode, bool uses_super_property, |
- bool calls_eval) = 0; |
- |
- // 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, MessageTemplate::Template message, |
- const char* argument_opt, |
- ParseErrorType error_type) = 0; |
- |
- private: |
- DISALLOW_COPY_AND_ASSIGN(ParserRecorder); |
-}; |
- |
- |
-class SingletonLogger : public ParserRecorder { |
+class SingletonLogger final { |
marja
2016/11/04 14:59:57
Now the names make less sense than before, how abo
|
public: |
SingletonLogger() |
: has_error_(false), |
@@ -81,18 +56,16 @@ class SingletonLogger : public ParserRecorder { |
function_length_(-1), |
has_duplicate_parameters_(false), |
error_type_(kSyntaxError) {} |
- virtual ~SingletonLogger() {} |
void Reset() { has_error_ = false; } |
- virtual void LogFunction(int start, int end, int num_parameters, |
- int function_length, bool has_duplicate_parameters, |
- int literals, int properties, |
- LanguageMode language_mode, bool uses_super_property, |
- bool calls_eval) { |
+ void LogFunction(int start, int end, int num_parameters, int function_length, |
+ bool has_duplicate_parameters, int literals, int properties, |
+ LanguageMode language_mode, bool uses_super_property, |
+ bool calls_eval) { |
DCHECK(!has_error_); |
- // Check that we only log at most one function. |
- DCHECK(start_ == -1 && end_ == -1); |
+ // Make sure we never nest function logging. |
+ DCHECK_LT(end_, start); |
start_ = start; |
end_ = end; |
num_parameters_ = num_parameters; |
@@ -108,8 +81,8 @@ 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, MessageTemplate::Template message, |
- const char* argument_opt, ParseErrorType error_type) { |
+ 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; |
@@ -187,8 +160,7 @@ class SingletonLogger : public ParserRecorder { |
ParseErrorType error_type_; |
}; |
- |
-class CompleteParserRecorder : public ParserRecorder { |
+class CompleteParserRecorder final { |
public: |
struct Key { |
bool is_one_byte; |
@@ -196,19 +168,17 @@ class CompleteParserRecorder : public ParserRecorder { |
}; |
CompleteParserRecorder(); |
- virtual ~CompleteParserRecorder() {} |
- virtual void LogFunction(int start, int end, int num_parameters, |
- int function_length, bool has_duplicate_parameters, |
- int literals, int properties, |
- LanguageMode language_mode, bool uses_super_property, |
- bool calls_eval); |
+ void LogFunction(int start, int end, int num_parameters, int function_length, |
+ bool has_duplicate_parameters, int literals, int properties, |
+ 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. |
- virtual void LogMessage(int start, int end, MessageTemplate::Template message, |
- const char* argument_opt, ParseErrorType error_type); |
+ void LogMessage(int start, int end, MessageTemplate::Template message, |
+ const char* argument_opt, ParseErrorType error_type); |
ScriptData* GetScriptData(); |
bool HasError() { |