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

Side by Side Diff: src/parsing/preparser.cc

Issue 2312263002: [parser] Refactor of Parse*Statement*, part 2 (Closed)
Patch Set: The real patch Created 4 years, 3 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 unified diff | Download patch
« no previous file with comments | « src/parsing/preparser.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include <cmath> 5 #include <cmath>
6 6
7 #include "src/allocation.h" 7 #include "src/allocation.h"
8 #include "src/base/logging.h" 8 #include "src/base/logging.h"
9 #include "src/conversions-inl.h" 9 #include "src/conversions-inl.h"
10 #include "src/conversions.h" 10 #include "src/conversions.h"
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after
188 int pos = position(); 188 int pos = position();
189 bool is_strict_reserved = false; 189 bool is_strict_reserved = false;
190 Identifier name = 190 Identifier name =
191 ParseIdentifierOrStrictReservedWord(&is_strict_reserved, CHECK_OK); 191 ParseIdentifierOrStrictReservedWord(&is_strict_reserved, CHECK_OK);
192 ExpressionClassifier no_classifier(this); 192 ExpressionClassifier no_classifier(this);
193 ParseClassLiteral(name, scanner()->location(), is_strict_reserved, pos, 193 ParseClassLiteral(name, scanner()->location(), is_strict_reserved, pos,
194 CHECK_OK); 194 CHECK_OK);
195 return Statement::Default(); 195 return Statement::Default();
196 } 196 }
197 197
198 PreParser::Statement PreParser::ParseBlock(
199 ZoneList<const AstRawString*>* labels, bool* ok) {
200 // Block ::
201 // '{' StatementList '}'
202
203 Expect(Token::LBRACE, CHECK_OK);
204 Statement final = Statement::Default();
205 {
206 BlockState block_state(&scope_state_);
207 while (peek() != Token::RBRACE) {
208 final = ParseStatementListItem(CHECK_OK);
209 }
210 }
211 Expect(Token::RBRACE, ok);
212 return final;
213 }
214
215 PreParser::Statement PreParser::ParseVariableStatement( 198 PreParser::Statement PreParser::ParseVariableStatement(
216 VariableDeclarationContext var_context, 199 VariableDeclarationContext var_context,
217 ZoneList<const AstRawString*>* names, bool* ok) { 200 ZoneList<const AstRawString*>* names, bool* ok) {
218 // VariableStatement :: 201 // VariableStatement ::
219 // VariableDeclarations ';' 202 // VariableDeclarations ';'
220 203
221 Statement result = 204 Statement result =
222 ParseVariableDeclarations(var_context, nullptr, names, CHECK_OK); 205 ParseVariableDeclarations(var_context, nullptr, names, CHECK_OK);
223 ExpectSemicolon(CHECK_OK); 206 ExpectSemicolon(CHECK_OK);
224 return result; 207 return result;
(...skipping 689 matching lines...) Expand 10 before | Expand all | Expand 10 after
914 897
915 body->Add(PreParserStatement::ExpressionStatement(return_value), zone()); 898 body->Add(PreParserStatement::ExpressionStatement(return_value), zone());
916 } 899 }
917 900
918 #undef CHECK_OK 901 #undef CHECK_OK
919 #undef CHECK_OK_CUSTOM 902 #undef CHECK_OK_CUSTOM
920 903
921 904
922 } // namespace internal 905 } // namespace internal
923 } // namespace v8 906 } // namespace v8
OLDNEW
« 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