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

Unified Diff: src/parsing/preparser.cc

Issue 2267663002: [parser] Apply an adaptation of the CRTP (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@nickie-2263973003-add-const
Patch Set: Formatting Created 4 years, 4 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/parsing/preparser.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/parsing/preparser.cc
diff --git a/src/parsing/preparser.cc b/src/parsing/preparser.cc
index 9696cc75ba230d409fa8f3468e6e83c16cf7e63f..45df9d8424ef2833ffae1d44712f1cf397b04575 100644
--- a/src/parsing/preparser.cc
+++ b/src/parsing/preparser.cc
@@ -41,24 +41,21 @@ namespace internal {
#define DUMMY ) // to make indentation work
#undef DUMMY
-void PreParserTraits::ReportMessageAt(Scanner::Location source_location,
- MessageTemplate::Template message,
- const char* arg,
- ParseErrorType error_type) {
- pre_parser_->log_->LogMessage(source_location.beg_pos,
- source_location.end_pos, message, arg,
- error_type);
+void ParserBaseTraits<PreParser>::ReportMessageAt(
+ Scanner::Location source_location, MessageTemplate::Template message,
+ const char* arg, ParseErrorType error_type) {
+ delegate()->log_->LogMessage(source_location.beg_pos, source_location.end_pos,
+ message, arg, error_type);
}
-void PreParserTraits::ReportMessageAt(Scanner::Location source_location,
- MessageTemplate::Template message,
- const AstRawString* arg,
- ParseErrorType error_type) {
+void ParserBaseTraits<PreParser>::ReportMessageAt(
+ Scanner::Location source_location, MessageTemplate::Template message,
+ const AstRawString* arg, ParseErrorType error_type) {
UNREACHABLE();
}
-
-PreParserIdentifier PreParserTraits::GetSymbol(Scanner* scanner) const {
+PreParserIdentifier ParserBaseTraits<PreParser>::GetSymbol(
+ Scanner* scanner) const {
switch (scanner->current_token()) {
case Token::ENUM:
return PreParserIdentifier::Enum();
@@ -89,8 +86,7 @@ PreParserIdentifier PreParserTraits::GetSymbol(Scanner* scanner) const {
}
}
-
-PreParserExpression PreParserTraits::ExpressionFromString(
+PreParserExpression ParserBaseTraits<PreParser>::ExpressionFromString(
int pos, Scanner* scanner, PreParserFactory* factory) const {
if (scanner->UnescapedLiteralMatches("use strict", 10)) {
return PreParserExpression::UseStrictStringLiteral();
@@ -98,18 +94,16 @@ PreParserExpression PreParserTraits::ExpressionFromString(
return PreParserExpression::StringLiteral();
}
-
-PreParserExpression PreParserTraits::ParseV8Intrinsic(bool* ok) {
- return pre_parser_->ParseV8Intrinsic(ok);
+PreParserExpression ParserBaseTraits<PreParser>::ParseV8Intrinsic(bool* ok) {
+ return delegate()->ParseV8Intrinsic(ok);
}
-
-PreParserExpression PreParserTraits::ParseFunctionLiteral(
+PreParserExpression ParserBaseTraits<PreParser>::ParseFunctionLiteral(
PreParserIdentifier name, Scanner::Location function_name_location,
FunctionNameValidity function_name_validity, FunctionKind kind,
int function_token_position, FunctionLiteral::FunctionType type,
LanguageMode language_mode, bool* ok) {
- return pre_parser_->ParseFunctionLiteral(
+ return delegate()->ParseFunctionLiteral(
name, function_name_location, function_name_validity, kind,
function_token_position, type, language_mode, ok);
}
@@ -154,12 +148,12 @@ PreParser::PreParseResult PreParser::PreParseLazyFunction(
return kPreParseSuccess;
}
-PreParserExpression PreParserTraits::ParseClassLiteral(
+PreParserExpression ParserBaseTraits<PreParser>::ParseClassLiteral(
Type::ExpressionClassifier* classifier, PreParserIdentifier name,
Scanner::Location class_name_location, bool name_is_strict_reserved,
int pos, bool* ok) {
- return pre_parser_->ParseClassLiteral(classifier, name, class_name_location,
- name_is_strict_reserved, pos, ok);
+ return delegate()->ParseClassLiteral(classifier, name, class_name_location,
+ name_is_strict_reserved, pos, ok);
}
@@ -1280,13 +1274,13 @@ PreParserExpression PreParser::ParseDoExpression(bool* ok) {
return PreParserExpression::Default();
}
-void PreParserTraits::ParseAsyncArrowSingleExpressionBody(
+void ParserBaseTraits<PreParser>::ParseAsyncArrowSingleExpressionBody(
PreParserStatementList body, bool accept_IN,
Type::ExpressionClassifier* classifier, int pos, bool* ok) {
- Scope* scope = pre_parser_->scope();
+ Scope* scope = delegate()->scope();
scope->ForceContextAllocation();
- PreParserExpression return_value = pre_parser_->ParseAssignmentExpression(
+ PreParserExpression return_value = delegate()->ParseAssignmentExpression(
accept_IN, classifier, CHECK_OK_CUSTOM(Void));
body->Add(PreParserStatement::ExpressionStatement(return_value), zone());
« no previous file with comments | « src/parsing/preparser.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698