Reviewers: adamk,

Message:
PTAL

Description:
Rename ParseSourceElements in preparser too

BUG=None
R=adamk
LOG=N

Please review this at https://codereview.chromium.org/905003003/

Base URL: https://chromium.googlesource.com/v8/v8.git@master

Affected files (+12, -12 lines):
  M src/parser.cc
  M src/preparser.h
  M src/preparser.cc


Index: src/parser.cc
diff --git a/src/parser.cc b/src/parser.cc
index f1b64aa7f429d1f22a874154278a14f759b801fb..42be09a2d4895ff4b44d28e73166088347f9221e 100644
--- a/src/parser.cc
+++ b/src/parser.cc
@@ -2077,7 +2077,7 @@ Block* Parser::ParseScopedBlock(ZoneList<const AstRawString*>* labels,
   // The harmony mode uses block elements instead of statements.
   //
   // Block ::
-  //   '{' BlockElement* '}'
+  //   '{' StatementList '}'

   // Construct block expecting 16 statements.
   Block* body =
Index: src/preparser.cc
diff --git a/src/preparser.cc b/src/preparser.cc
index 3617bb23ca9964b44f2a5e00c8069cae60e9af15..2f8ca5d0ebe70239981fad663350f587b876f06c 100644
--- a/src/preparser.cc
+++ b/src/preparser.cc
@@ -163,7 +163,7 @@ PreParserExpression PreParserTraits::ParseClassLiteral(
 #undef DUMMY


-PreParser::Statement PreParser::ParseSourceElement(bool* ok) {
+PreParser::Statement PreParser::ParseStatementListItem(bool* ok) {
   // ECMA 262 6th Edition
   // StatementListItem[Yield, Return] :
   //   Statement[?Yield, ?Return]
@@ -200,8 +200,8 @@ PreParser::Statement PreParser::ParseSourceElement(bool* ok) {
 }


-PreParser::SourceElements PreParser::ParseSourceElements(int end_token,
-                                                         bool* ok) {
+PreParser::SourceElements PreParser::ParseStatementList(int end_token,
+                                                        bool* ok) {
   // SourceElements ::
   //   (Statement)* <end_token>

@@ -210,7 +210,7 @@ PreParser::SourceElements PreParser::ParseSourceElements(int end_token,
     if (directive_prologue && peek() != Token::STRING) {
       directive_prologue = false;
     }
-    Statement statement = ParseSourceElement(CHECK_OK);
+    Statement statement = ParseStatementListItem(CHECK_OK);
     if (directive_prologue) {
       if (statement.IsUseStrictLiteral()) {
         scope_->SetLanguageMode(
@@ -387,7 +387,7 @@ PreParser::Statement PreParser::ParseBlock(bool* ok) {
   Expect(Token::LBRACE, CHECK_OK);
   while (peek() != Token::RBRACE) {
     if (allow_harmony_scoping() && is_strict(language_mode())) {
-      ParseSourceElement(CHECK_OK);
+      ParseStatementListItem(CHECK_OK);
     } else {
       ParseStatement(CHECK_OK);
     }
@@ -932,7 +932,7 @@ PreParser::Expression PreParser::ParseFunctionLiteral(
   if (is_lazily_parsed) {
     ParseLazyFunctionLiteralBody(CHECK_OK);
   } else {
-    ParseSourceElements(Token::RBRACE, ok);
+    ParseStatementList(Token::RBRACE, ok);
   }
   Expect(Token::RBRACE, CHECK_OK);

@@ -956,7 +956,7 @@ PreParser::Expression PreParser::ParseFunctionLiteral(

 void PreParser::ParseLazyFunctionLiteralBody(bool* ok) {
   int body_start = position();
-  ParseSourceElements(Token::RBRACE, ok);
+  ParseStatementList(Token::RBRACE, ok);
   if (!*ok) return;

   // Position right after terminal '}'.
Index: src/preparser.h
diff --git a/src/preparser.h b/src/preparser.h
index 982273f447482dc042a4c0d02f2702050b78702e..f3c807cd3a1c6f0c5e2396c8152e3e19900a13dd 100644
--- a/src/preparser.h
+++ b/src/preparser.h
@@ -1564,7 +1564,7 @@ class PreParser : public ParserBase<PreParserTraits> {
                             &factory);
     bool ok = true;
     int start_position = scanner()->peek_location().beg_pos;
-    ParseSourceElements(Token::EOS, &ok);
+    ParseStatementList(Token::EOS, &ok);
     if (stack_overflow()) return kPreParseStackOverflow;
     if (!ok) {
       ReportUnexpectedToken(scanner()->current_token());
@@ -1618,8 +1618,8 @@ class PreParser : public ParserBase<PreParserTraits> {
   // which is set to false if parsing failed; it is unchanged otherwise.
   // By making the 'exception handling' explicit, we are forced to check
   // for failure at the call sites.
-  Statement ParseSourceElement(bool* ok);
-  SourceElements ParseSourceElements(int end_token, bool* ok);
+  Statement ParseStatementListItem(bool* ok);
+  SourceElements ParseStatementList(int end_token, bool* ok);
   Statement ParseStatement(bool* ok);
   Statement ParseFunctionDeclaration(bool* ok);
   Statement ParseClassDeclaration(bool* ok);
@@ -1682,7 +1682,7 @@ PreParserStatementList PreParser::ParseEagerFunctionBody(
     Token::Value fvar_init_op, FunctionKind kind, bool* ok) {
   ParsingModeScope parsing_mode(this, PARSE_EAGERLY);

-  ParseSourceElements(Token::RBRACE, ok);
+  ParseStatementList(Token::RBRACE, ok);
   if (!*ok) return PreParserStatementList();

   Expect(Token::RBRACE, ok);


--
--
v8-dev mailing list
v8-dev@googlegroups.com
http://groups.google.com/group/v8-dev
--- You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to v8-dev+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to