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

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

Issue 2321103002: [parser] Refactor of Parse*Statement*, part 5 (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
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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 #ifndef V8_PARSING_PREPARSER_H 5 #ifndef V8_PARSING_PREPARSER_H
6 #define V8_PARSING_PREPARSER_H 6 #define V8_PARSING_PREPARSER_H
7 7
8 #include "src/ast/scopes.h" 8 #include "src/ast/scopes.h"
9 #include "src/parsing/parser-base.h" 9 #include "src/parsing/parser-base.h"
10 10
(...skipping 636 matching lines...) Expand 10 before | Expand all | Expand 10 after
647 PreParserStatement NewContinueStatement(PreParserStatement target, int pos) { 647 PreParserStatement NewContinueStatement(PreParserStatement target, int pos) {
648 return PreParserStatement::Jump(); 648 return PreParserStatement::Jump();
649 } 649 }
650 650
651 PreParserStatement NewWithStatement(Scope* scope, 651 PreParserStatement NewWithStatement(Scope* scope,
652 PreParserExpression expression, 652 PreParserExpression expression,
653 PreParserStatement statement, int pos) { 653 PreParserStatement statement, int pos) {
654 return PreParserStatement::Default(); 654 return PreParserStatement::Default();
655 } 655 }
656 656
657 PreParserStatement NewDoWhileStatement(ZoneList<const AstRawString*>* labels,
658 int pos) {
659 return PreParserStatement::Default();
660 }
661
662 PreParserStatement NewWhileStatement(ZoneList<const AstRawString*>* labels,
663 int pos) {
664 return PreParserStatement::Default();
665 }
666
657 // Return the object itself as AstVisitor and implement the needed 667 // Return the object itself as AstVisitor and implement the needed
658 // dummy method right in this class. 668 // dummy method right in this class.
659 PreParserFactory* visitor() { return this; } 669 PreParserFactory* visitor() { return this; }
660 int* ast_properties() { 670 int* ast_properties() {
661 static int dummy = 42; 671 static int dummy = 42;
662 return &dummy; 672 return &dummy;
663 } 673 }
664 }; 674 };
665 675
666 676
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
817 ZoneList<const AstRawString*>* names, 827 ZoneList<const AstRawString*>* names,
818 bool default_export, bool* ok); 828 bool default_export, bool* ok);
819 Statement ParseFunctionDeclaration(bool* ok); 829 Statement ParseFunctionDeclaration(bool* ok);
820 Statement ParseAsyncFunctionDeclaration(ZoneList<const AstRawString*>* names, 830 Statement ParseAsyncFunctionDeclaration(ZoneList<const AstRawString*>* names,
821 bool default_export, bool* ok); 831 bool default_export, bool* ok);
822 Expression ParseAsyncFunctionExpression(bool* ok); 832 Expression ParseAsyncFunctionExpression(bool* ok);
823 Statement ParseClassDeclaration(ZoneList<const AstRawString*>* names, 833 Statement ParseClassDeclaration(ZoneList<const AstRawString*>* names,
824 bool default_export, bool* ok); 834 bool default_export, bool* ok);
825 Statement ParseSwitchStatement(ZoneList<const AstRawString*>* labels, 835 Statement ParseSwitchStatement(ZoneList<const AstRawString*>* labels,
826 bool* ok); 836 bool* ok);
827 Statement ParseDoWhileStatement(ZoneList<const AstRawString*>* labels,
828 bool* ok);
829 Statement ParseWhileStatement(ZoneList<const AstRawString*>* labels,
830 bool* ok);
831 Statement ParseForStatement(ZoneList<const AstRawString*>* labels, bool* ok); 837 Statement ParseForStatement(ZoneList<const AstRawString*>* labels, bool* ok);
832 Statement ParseThrowStatement(bool* ok);
833 Statement ParseTryStatement(bool* ok); 838 Statement ParseTryStatement(bool* ok);
834 Expression ParseConditionalExpression(bool accept_IN, bool* ok); 839 Expression ParseConditionalExpression(bool accept_IN, bool* ok);
835 Expression ParseObjectLiteral(bool* ok); 840 Expression ParseObjectLiteral(bool* ok);
836 Expression ParseDoExpression(bool* ok);
837 841
838 V8_INLINE PreParserStatementList ParseEagerFunctionBody( 842 V8_INLINE PreParserStatementList ParseEagerFunctionBody(
839 PreParserIdentifier function_name, int pos, 843 PreParserIdentifier function_name, int pos,
840 const PreParserFormalParameters& parameters, FunctionKind kind, 844 const PreParserFormalParameters& parameters, FunctionKind kind,
841 FunctionLiteral::FunctionType function_type, bool* ok); 845 FunctionLiteral::FunctionType function_type, bool* ok);
842 846
843 V8_INLINE LazyParsingResult 847 V8_INLINE LazyParsingResult
844 SkipLazyFunctionBody(int* materialized_literal_count, 848 SkipLazyFunctionBody(int* materialized_literal_count,
845 int* expected_property_count, bool may_abort, bool* ok) { 849 int* expected_property_count, bool may_abort, bool* ok) {
846 UNREACHABLE(); 850 UNREACHABLE();
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
941 V8_INLINE bool ContainsLabel(ZoneList<const AstRawString*>* labels, 945 V8_INLINE bool ContainsLabel(ZoneList<const AstRawString*>* labels,
942 PreParserIdentifier label) { 946 PreParserIdentifier label) {
943 return false; 947 return false;
944 } 948 }
945 949
946 V8_INLINE PreParserExpression RewriteReturn(PreParserExpression return_value, 950 V8_INLINE PreParserExpression RewriteReturn(PreParserExpression return_value,
947 int pos) { 951 int pos) {
948 return return_value; 952 return return_value;
949 } 953 }
950 954
955 V8_INLINE PreParserExpression RewriteDoExpression(PreParserStatement body,
956 int pos, bool* ok) {
957 return PreParserExpression::Default();
958 }
959
960 V8_INLINE PreParserStatement InitializeLoop(PreParserStatement loop,
961 PreParserExpression cond,
962 PreParserStatement body) {
963 return loop;
964 }
965
951 // TODO(nikolaos): The preparser currently does not keep track of labels 966 // TODO(nikolaos): The preparser currently does not keep track of labels
952 // and targets. 967 // and targets.
953 V8_INLINE PreParserStatement LookupBreakTarget(PreParserIdentifier label, 968 V8_INLINE PreParserStatement LookupBreakTarget(PreParserIdentifier label,
954 bool* ok) { 969 bool* ok) {
955 return PreParserStatement::Default(); 970 return PreParserStatement::Default();
956 } 971 }
957 V8_INLINE PreParserStatement LookupContinueTarget(PreParserIdentifier label, 972 V8_INLINE PreParserStatement LookupContinueTarget(PreParserIdentifier label,
958 bool* ok) { 973 bool* ok) {
959 return PreParserStatement::Default(); 974 return PreParserStatement::Default();
960 } 975 }
(...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after
1253 bool ignore_completion_value, int pos) { 1268 bool ignore_completion_value, int pos) {
1254 return PreParserStatement::Default(); 1269 return PreParserStatement::Default();
1255 } 1270 }
1256 1271
1257 V8_INLINE PreParserExpression 1272 V8_INLINE PreParserExpression
1258 NewV8Intrinsic(PreParserIdentifier name, PreParserExpressionList arguments, 1273 NewV8Intrinsic(PreParserIdentifier name, PreParserExpressionList arguments,
1259 int pos, bool* ok) { 1274 int pos, bool* ok) {
1260 return PreParserExpression::Default(); 1275 return PreParserExpression::Default();
1261 } 1276 }
1262 1277
1278 V8_INLINE PreParserStatement NewThrowStatement(PreParserExpression exception,
1279 int pos) {
1280 return PreParserStatement::Jump();
1281 }
1282
1263 V8_INLINE void AddParameterInitializationBlock( 1283 V8_INLINE void AddParameterInitializationBlock(
1264 const PreParserFormalParameters& parameters, PreParserStatementList body, 1284 const PreParserFormalParameters& parameters, PreParserStatementList body,
1265 bool is_async, bool* ok) {} 1285 bool is_async, bool* ok) {}
1266 1286
1267 V8_INLINE void AddFormalParameter(PreParserFormalParameters* parameters, 1287 V8_INLINE void AddFormalParameter(PreParserFormalParameters* parameters,
1268 PreParserExpression pattern, 1288 PreParserExpression pattern,
1269 PreParserExpression initializer, 1289 PreParserExpression initializer,
1270 int initializer_end_position, 1290 int initializer_end_position,
1271 bool is_rest) { 1291 bool is_rest) {
1272 ++parameters->arity; 1292 ++parameters->arity;
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
1376 function_state_->NextMaterializedLiteralIndex(); 1396 function_state_->NextMaterializedLiteralIndex();
1377 function_state_->NextMaterializedLiteralIndex(); 1397 function_state_->NextMaterializedLiteralIndex();
1378 } 1398 }
1379 return EmptyExpression(); 1399 return EmptyExpression();
1380 } 1400 }
1381 1401
1382 } // namespace internal 1402 } // namespace internal
1383 } // namespace v8 1403 } // namespace v8
1384 1404
1385 #endif // V8_PARSING_PREPARSER_H 1405 #endif // V8_PARSING_PREPARSER_H
OLDNEW
« src/parsing/parser.h ('K') | « src/parsing/parser-base.h ('k') | src/parsing/preparser.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698