OLD | NEW |
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 433 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
444 | 444 |
445 bool IsEmptyStatement() { return code_ == kEmptyStatement; } | 445 bool IsEmptyStatement() { return code_ == kEmptyStatement; } |
446 | 446 |
447 // Dummy implementation for making statement->somefunc() work in both Parser | 447 // Dummy implementation for making statement->somefunc() work in both Parser |
448 // and PreParser. | 448 // and PreParser. |
449 PreParserStatement* operator->() { return this; } | 449 PreParserStatement* operator->() { return this; } |
450 | 450 |
451 PreParserStatementList statements() { return PreParserStatementList(); } | 451 PreParserStatementList statements() { return PreParserStatementList(); } |
452 void set_scope(Scope* scope) {} | 452 void set_scope(Scope* scope) {} |
453 void Initialize(PreParserExpression cond, PreParserStatement body) {} | 453 void Initialize(PreParserExpression cond, PreParserStatement body) {} |
| 454 void Initialize(PreParserStatement init, PreParserExpression cond, |
| 455 PreParserStatement next, PreParserStatement body) {} |
454 | 456 |
455 private: | 457 private: |
456 enum Type { | 458 enum Type { |
457 kNullStatement, | 459 kNullStatement, |
458 kEmptyStatement, | 460 kEmptyStatement, |
459 kUnknownStatement, | 461 kUnknownStatement, |
460 kJumpStatement, | 462 kJumpStatement, |
461 kStringLiteralExpressionStatement, | 463 kStringLiteralExpressionStatement, |
462 kUseStrictExpressionStatement, | 464 kUseStrictExpressionStatement, |
463 kUseAsmExpressionStatement, | 465 kUseAsmExpressionStatement, |
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
659 PreParserStatement NewSwitchStatement(ZoneList<const AstRawString*>* labels, | 661 PreParserStatement NewSwitchStatement(ZoneList<const AstRawString*>* labels, |
660 int pos) { | 662 int pos) { |
661 return PreParserStatement::Default(); | 663 return PreParserStatement::Default(); |
662 } | 664 } |
663 | 665 |
664 PreParserStatement NewCaseClause(PreParserExpression label, | 666 PreParserStatement NewCaseClause(PreParserExpression label, |
665 PreParserStatementList statements, int pos) { | 667 PreParserStatementList statements, int pos) { |
666 return PreParserStatement::Default(); | 668 return PreParserStatement::Default(); |
667 } | 669 } |
668 | 670 |
| 671 PreParserStatement NewForStatement(ZoneList<const AstRawString*>* labels, |
| 672 int pos) { |
| 673 return PreParserStatement::Default(); |
| 674 } |
| 675 |
| 676 PreParserStatement NewForEachStatement(ForEachStatement::VisitMode visit_mode, |
| 677 ZoneList<const AstRawString*>* labels, |
| 678 int pos) { |
| 679 return PreParserStatement::Default(); |
| 680 } |
| 681 |
669 // Return the object itself as AstVisitor and implement the needed | 682 // Return the object itself as AstVisitor and implement the needed |
670 // dummy method right in this class. | 683 // dummy method right in this class. |
671 PreParserFactory* visitor() { return this; } | 684 PreParserFactory* visitor() { return this; } |
672 int* ast_properties() { | 685 int* ast_properties() { |
673 static int dummy = 42; | 686 static int dummy = 42; |
674 return &dummy; | 687 return &dummy; |
675 } | 688 } |
676 }; | 689 }; |
677 | 690 |
678 | 691 |
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
822 // All ParseXXX functions take as the last argument an *ok parameter | 835 // All ParseXXX functions take as the last argument an *ok parameter |
823 // which is set to false if parsing failed; it is unchanged otherwise. | 836 // which is set to false if parsing failed; it is unchanged otherwise. |
824 // By making the 'exception handling' explicit, we are forced to check | 837 // By making the 'exception handling' explicit, we are forced to check |
825 // for failure at the call sites. | 838 // for failure at the call sites. |
826 Statement ParseFunctionDeclaration(bool* ok); | 839 Statement ParseFunctionDeclaration(bool* ok); |
827 Statement ParseAsyncFunctionDeclaration(ZoneList<const AstRawString*>* names, | 840 Statement ParseAsyncFunctionDeclaration(ZoneList<const AstRawString*>* names, |
828 bool default_export, bool* ok); | 841 bool default_export, bool* ok); |
829 Expression ParseAsyncFunctionExpression(bool* ok); | 842 Expression ParseAsyncFunctionExpression(bool* ok); |
830 Statement ParseClassDeclaration(ZoneList<const AstRawString*>* names, | 843 Statement ParseClassDeclaration(ZoneList<const AstRawString*>* names, |
831 bool default_export, bool* ok); | 844 bool default_export, bool* ok); |
832 Statement ParseForStatement(ZoneList<const AstRawString*>* labels, bool* ok); | |
833 Expression ParseConditionalExpression(bool accept_IN, bool* ok); | 845 Expression ParseConditionalExpression(bool accept_IN, bool* ok); |
834 Expression ParseObjectLiteral(bool* ok); | 846 Expression ParseObjectLiteral(bool* ok); |
835 | 847 |
836 V8_INLINE PreParserStatementList ParseEagerFunctionBody( | 848 V8_INLINE PreParserStatementList ParseEagerFunctionBody( |
837 PreParserIdentifier function_name, int pos, | 849 PreParserIdentifier function_name, int pos, |
838 const PreParserFormalParameters& parameters, FunctionKind kind, | 850 const PreParserFormalParameters& parameters, FunctionKind kind, |
839 FunctionLiteral::FunctionType function_type, bool* ok); | 851 FunctionLiteral::FunctionType function_type, bool* ok); |
840 | 852 |
841 V8_INLINE LazyParsingResult | 853 V8_INLINE LazyParsingResult |
842 SkipLazyFunctionBody(int* materialized_literal_count, | 854 SkipLazyFunctionBody(int* materialized_literal_count, |
(...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1114 V8_INLINE PreParserExpression BuildUnaryExpression( | 1126 V8_INLINE PreParserExpression BuildUnaryExpression( |
1115 PreParserExpression expression, Token::Value op, int pos) { | 1127 PreParserExpression expression, Token::Value op, int pos) { |
1116 return PreParserExpression::Default(); | 1128 return PreParserExpression::Default(); |
1117 } | 1129 } |
1118 | 1130 |
1119 V8_INLINE PreParserExpression BuildIteratorResult(PreParserExpression value, | 1131 V8_INLINE PreParserExpression BuildIteratorResult(PreParserExpression value, |
1120 bool done) { | 1132 bool done) { |
1121 return PreParserExpression::Default(); | 1133 return PreParserExpression::Default(); |
1122 } | 1134 } |
1123 | 1135 |
| 1136 V8_INLINE PreParserStatement |
| 1137 BuildInitializationBlock(DeclarationParsingResult* parsing_result, |
| 1138 ZoneList<const AstRawString*>* names, bool* ok) { |
| 1139 return PreParserStatement::Default(); |
| 1140 } |
| 1141 |
| 1142 V8_INLINE PreParserStatement |
| 1143 InitializeForEachStatement(PreParserStatement stmt, PreParserExpression each, |
| 1144 PreParserExpression subject, |
| 1145 PreParserStatement body, int each_keyword_pos) { |
| 1146 return stmt; |
| 1147 } |
| 1148 |
| 1149 V8_INLINE PreParserStatement RewriteForVarInLegacy(const ForInfo& for_info) { |
| 1150 return PreParserStatement::Null(); |
| 1151 } |
| 1152 V8_INLINE void DesugarBindingInForEachStatement( |
| 1153 ForInfo* for_info, PreParserStatement* body_block, |
| 1154 PreParserExpression* each_variable, bool* ok) {} |
| 1155 V8_INLINE PreParserStatement CreateForEachStatementTDZ( |
| 1156 PreParserStatement init_block, const ForInfo& for_info, bool* ok) { |
| 1157 return init_block; |
| 1158 } |
| 1159 |
| 1160 V8_INLINE StatementT DesugarLexicalBindingsInForStatement( |
| 1161 PreParserStatement loop, PreParserStatement init, |
| 1162 PreParserExpression cond, PreParserStatement next, |
| 1163 PreParserStatement body, Scope* inner_scope, const ForInfo& for_info, |
| 1164 bool* ok) { |
| 1165 return loop; |
| 1166 } |
| 1167 |
1124 V8_INLINE PreParserExpression | 1168 V8_INLINE PreParserExpression |
1125 NewThrowReferenceError(MessageTemplate::Template message, int pos) { | 1169 NewThrowReferenceError(MessageTemplate::Template message, int pos) { |
1126 return PreParserExpression::Default(); | 1170 return PreParserExpression::Default(); |
1127 } | 1171 } |
1128 | 1172 |
1129 V8_INLINE PreParserExpression NewThrowSyntaxError( | 1173 V8_INLINE PreParserExpression NewThrowSyntaxError( |
1130 MessageTemplate::Template message, PreParserIdentifier arg, int pos) { | 1174 MessageTemplate::Template message, PreParserIdentifier arg, int pos) { |
1131 return PreParserExpression::Default(); | 1175 return PreParserExpression::Default(); |
1132 } | 1176 } |
1133 | 1177 |
(...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1416 function_state_->NextMaterializedLiteralIndex(); | 1460 function_state_->NextMaterializedLiteralIndex(); |
1417 function_state_->NextMaterializedLiteralIndex(); | 1461 function_state_->NextMaterializedLiteralIndex(); |
1418 } | 1462 } |
1419 return EmptyExpression(); | 1463 return EmptyExpression(); |
1420 } | 1464 } |
1421 | 1465 |
1422 } // namespace internal | 1466 } // namespace internal |
1423 } // namespace v8 | 1467 } // namespace v8 |
1424 | 1468 |
1425 #endif // V8_PARSING_PREPARSER_H | 1469 #endif // V8_PARSING_PREPARSER_H |
OLD | NEW |