| 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 633 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 644 PreParserStatement NewDoWhileStatement(ZoneList<const AstRawString*>* labels, | 644 PreParserStatement NewDoWhileStatement(ZoneList<const AstRawString*>* labels, |
| 645 int pos) { | 645 int pos) { |
| 646 return PreParserStatement::Default(); | 646 return PreParserStatement::Default(); |
| 647 } | 647 } |
| 648 | 648 |
| 649 PreParserStatement NewWhileStatement(ZoneList<const AstRawString*>* labels, | 649 PreParserStatement NewWhileStatement(ZoneList<const AstRawString*>* labels, |
| 650 int pos) { | 650 int pos) { |
| 651 return PreParserStatement::Default(); | 651 return PreParserStatement::Default(); |
| 652 } | 652 } |
| 653 | 653 |
| 654 PreParserStatement NewSwitchStatement(ZoneList<const AstRawString*>* labels, |
| 655 int pos) { |
| 656 return PreParserStatement::Default(); |
| 657 } |
| 658 |
| 659 PreParserStatement NewCaseClause(PreParserExpression label, |
| 660 PreParserStatementList statements, int pos) { |
| 661 return PreParserStatement::Default(); |
| 662 } |
| 663 |
| 654 // Return the object itself as AstVisitor and implement the needed | 664 // Return the object itself as AstVisitor and implement the needed |
| 655 // dummy method right in this class. | 665 // dummy method right in this class. |
| 656 PreParserFactory* visitor() { return this; } | 666 PreParserFactory* visitor() { return this; } |
| 657 int* ast_properties() { | 667 int* ast_properties() { |
| 658 static int dummy = 42; | 668 static int dummy = 42; |
| 659 return &dummy; | 669 return &dummy; |
| 660 } | 670 } |
| 661 }; | 671 }; |
| 662 | 672 |
| 663 | 673 |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 697 typedef PreParserExpression Expression; | 707 typedef PreParserExpression Expression; |
| 698 typedef PreParserExpression FunctionLiteral; | 708 typedef PreParserExpression FunctionLiteral; |
| 699 typedef PreParserExpression ObjectLiteralProperty; | 709 typedef PreParserExpression ObjectLiteralProperty; |
| 700 typedef PreParserExpression ClassLiteralProperty; | 710 typedef PreParserExpression ClassLiteralProperty; |
| 701 typedef PreParserExpressionList ExpressionList; | 711 typedef PreParserExpressionList ExpressionList; |
| 702 typedef PreParserExpressionList PropertyList; | 712 typedef PreParserExpressionList PropertyList; |
| 703 typedef PreParserFormalParameters FormalParameters; | 713 typedef PreParserFormalParameters FormalParameters; |
| 704 typedef PreParserStatement Statement; | 714 typedef PreParserStatement Statement; |
| 705 typedef PreParserStatementList StatementList; | 715 typedef PreParserStatementList StatementList; |
| 706 typedef PreParserStatement Block; | 716 typedef PreParserStatement Block; |
| 707 typedef PreParserStatement BreakableStatementT; | 717 typedef PreParserStatement BreakableStatement; |
| 708 typedef PreParserStatement IterationStatementT; | 718 typedef PreParserStatement IterationStatement; |
| 709 | 719 |
| 710 // For constructing objects returned by the traversing functions. | 720 // For constructing objects returned by the traversing functions. |
| 711 typedef PreParserFactory Factory; | 721 typedef PreParserFactory Factory; |
| 712 | 722 |
| 713 typedef PreParserTarget Target; | 723 typedef PreParserTarget Target; |
| 714 typedef PreParserTargetScope TargetScope; | 724 typedef PreParserTargetScope TargetScope; |
| 715 }; | 725 }; |
| 716 | 726 |
| 717 | 727 |
| 718 // Preparsing checks a JavaScript program and emits preparse-data that helps | 728 // Preparsing checks a JavaScript program and emits preparse-data that helps |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 807 // All ParseXXX functions take as the last argument an *ok parameter | 817 // All ParseXXX functions take as the last argument an *ok parameter |
| 808 // which is set to false if parsing failed; it is unchanged otherwise. | 818 // which is set to false if parsing failed; it is unchanged otherwise. |
| 809 // By making the 'exception handling' explicit, we are forced to check | 819 // By making the 'exception handling' explicit, we are forced to check |
| 810 // for failure at the call sites. | 820 // for failure at the call sites. |
| 811 Statement ParseFunctionDeclaration(bool* ok); | 821 Statement ParseFunctionDeclaration(bool* ok); |
| 812 Statement ParseAsyncFunctionDeclaration(ZoneList<const AstRawString*>* names, | 822 Statement ParseAsyncFunctionDeclaration(ZoneList<const AstRawString*>* names, |
| 813 bool default_export, bool* ok); | 823 bool default_export, bool* ok); |
| 814 Expression ParseAsyncFunctionExpression(bool* ok); | 824 Expression ParseAsyncFunctionExpression(bool* ok); |
| 815 Statement ParseClassDeclaration(ZoneList<const AstRawString*>* names, | 825 Statement ParseClassDeclaration(ZoneList<const AstRawString*>* names, |
| 816 bool default_export, bool* ok); | 826 bool default_export, bool* ok); |
| 817 Statement ParseSwitchStatement(ZoneList<const AstRawString*>* labels, | |
| 818 bool* ok); | |
| 819 Statement ParseForStatement(ZoneList<const AstRawString*>* labels, bool* ok); | 827 Statement ParseForStatement(ZoneList<const AstRawString*>* labels, bool* ok); |
| 820 Statement ParseTryStatement(bool* ok); | 828 Statement ParseTryStatement(bool* ok); |
| 821 Expression ParseConditionalExpression(bool accept_IN, bool* ok); | 829 Expression ParseConditionalExpression(bool accept_IN, bool* ok); |
| 822 Expression ParseObjectLiteral(bool* ok); | 830 Expression ParseObjectLiteral(bool* ok); |
| 823 | 831 |
| 824 V8_INLINE PreParserStatementList ParseEagerFunctionBody( | 832 V8_INLINE PreParserStatementList ParseEagerFunctionBody( |
| 825 PreParserIdentifier function_name, int pos, | 833 PreParserIdentifier function_name, int pos, |
| 826 const PreParserFormalParameters& parameters, FunctionKind kind, | 834 const PreParserFormalParameters& parameters, FunctionKind kind, |
| 827 FunctionLiteral::FunctionType function_type, bool* ok); | 835 FunctionLiteral::FunctionType function_type, bool* ok); |
| 828 | 836 |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 926 // TODO(nikolaos): The preparser currently does not keep track of labels. | 934 // TODO(nikolaos): The preparser currently does not keep track of labels. |
| 927 V8_INLINE bool ContainsLabel(ZoneList<const AstRawString*>* labels, | 935 V8_INLINE bool ContainsLabel(ZoneList<const AstRawString*>* labels, |
| 928 PreParserIdentifier label) { | 936 PreParserIdentifier label) { |
| 929 return false; | 937 return false; |
| 930 } | 938 } |
| 931 | 939 |
| 932 V8_INLINE PreParserExpression RewriteReturn(PreParserExpression return_value, | 940 V8_INLINE PreParserExpression RewriteReturn(PreParserExpression return_value, |
| 933 int pos) { | 941 int pos) { |
| 934 return return_value; | 942 return return_value; |
| 935 } | 943 } |
| 944 V8_INLINE PreParserStatement RewriteSwitchStatement( |
| 945 PreParserExpression tag, PreParserStatement switch_statement, |
| 946 PreParserStatementList cases, Scope* scope) { |
| 947 return PreParserStatement::Default(); |
| 948 } |
| 936 | 949 |
| 937 V8_INLINE PreParserExpression RewriteDoExpression(PreParserStatement body, | 950 V8_INLINE PreParserExpression RewriteDoExpression(PreParserStatement body, |
| 938 int pos, bool* ok) { | 951 int pos, bool* ok) { |
| 939 return PreParserExpression::Default(); | 952 return PreParserExpression::Default(); |
| 940 } | 953 } |
| 941 | 954 |
| 942 // TODO(nikolaos): The preparser currently does not keep track of labels | 955 // TODO(nikolaos): The preparser currently does not keep track of labels |
| 943 // and targets. | 956 // and targets. |
| 944 V8_INLINE PreParserStatement LookupBreakTarget(PreParserIdentifier label, | 957 V8_INLINE PreParserStatement LookupBreakTarget(PreParserIdentifier label, |
| 945 bool* ok) { | 958 bool* ok) { |
| (...skipping 303 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1249 } | 1262 } |
| 1250 | 1263 |
| 1251 V8_INLINE PreParserExpressionList NewPropertyList(int size) const { | 1264 V8_INLINE PreParserExpressionList NewPropertyList(int size) const { |
| 1252 return PreParserExpressionList(); | 1265 return PreParserExpressionList(); |
| 1253 } | 1266 } |
| 1254 | 1267 |
| 1255 V8_INLINE PreParserStatementList NewStatementList(int size) const { | 1268 V8_INLINE PreParserStatementList NewStatementList(int size) const { |
| 1256 return PreParserStatementList(); | 1269 return PreParserStatementList(); |
| 1257 } | 1270 } |
| 1258 | 1271 |
| 1272 PreParserStatementList NewCaseClauseList(int size) { |
| 1273 return PreParserStatementList(); |
| 1274 } |
| 1275 |
| 1259 V8_INLINE static PreParserStatement NewBlock( | 1276 V8_INLINE static PreParserStatement NewBlock( |
| 1260 ZoneList<const AstRawString*>* labels, int capacity, | 1277 ZoneList<const AstRawString*>* labels, int capacity, |
| 1261 bool ignore_completion_value, int pos) { | 1278 bool ignore_completion_value, int pos) { |
| 1262 return PreParserStatement::Default(); | 1279 return PreParserStatement::Default(); |
| 1263 } | 1280 } |
| 1264 | 1281 |
| 1265 V8_INLINE PreParserExpression | 1282 V8_INLINE PreParserExpression |
| 1266 NewV8Intrinsic(PreParserIdentifier name, PreParserExpressionList arguments, | 1283 NewV8Intrinsic(PreParserIdentifier name, PreParserExpressionList arguments, |
| 1267 int pos, bool* ok) { | 1284 int pos, bool* ok) { |
| 1268 return PreParserExpression::Default(); | 1285 return PreParserExpression::Default(); |
| (...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1389 function_state_->NextMaterializedLiteralIndex(); | 1406 function_state_->NextMaterializedLiteralIndex(); |
| 1390 function_state_->NextMaterializedLiteralIndex(); | 1407 function_state_->NextMaterializedLiteralIndex(); |
| 1391 } | 1408 } |
| 1392 return EmptyExpression(); | 1409 return EmptyExpression(); |
| 1393 } | 1410 } |
| 1394 | 1411 |
| 1395 } // namespace internal | 1412 } // namespace internal |
| 1396 } // namespace v8 | 1413 } // namespace v8 |
| 1397 | 1414 |
| 1398 #endif // V8_PARSING_PREPARSER_H | 1415 #endif // V8_PARSING_PREPARSER_H |
| OLD | NEW |