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 807 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
818 // 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. |
819 // By making the 'exception handling' explicit, we are forced to check | 819 // By making the 'exception handling' explicit, we are forced to check |
820 // for failure at the call sites. | 820 // for failure at the call sites. |
821 Statement ParseFunctionDeclaration(bool* ok); | 821 Statement ParseFunctionDeclaration(bool* ok); |
822 Statement ParseAsyncFunctionDeclaration(ZoneList<const AstRawString*>* names, | 822 Statement ParseAsyncFunctionDeclaration(ZoneList<const AstRawString*>* names, |
823 bool default_export, bool* ok); | 823 bool default_export, bool* ok); |
824 Expression ParseAsyncFunctionExpression(bool* ok); | 824 Expression ParseAsyncFunctionExpression(bool* ok); |
825 Statement ParseClassDeclaration(ZoneList<const AstRawString*>* names, | 825 Statement ParseClassDeclaration(ZoneList<const AstRawString*>* names, |
826 bool default_export, bool* ok); | 826 bool default_export, bool* ok); |
827 Statement ParseForStatement(ZoneList<const AstRawString*>* labels, bool* ok); | 827 Statement ParseForStatement(ZoneList<const AstRawString*>* labels, bool* ok); |
828 Statement ParseTryStatement(bool* ok); | |
829 Expression ParseConditionalExpression(bool accept_IN, bool* ok); | 828 Expression ParseConditionalExpression(bool accept_IN, bool* ok); |
830 Expression ParseObjectLiteral(bool* ok); | 829 Expression ParseObjectLiteral(bool* ok); |
831 | 830 |
832 V8_INLINE PreParserStatementList ParseEagerFunctionBody( | 831 V8_INLINE PreParserStatementList ParseEagerFunctionBody( |
833 PreParserIdentifier function_name, int pos, | 832 PreParserIdentifier function_name, int pos, |
834 const PreParserFormalParameters& parameters, FunctionKind kind, | 833 const PreParserFormalParameters& parameters, FunctionKind kind, |
835 FunctionLiteral::FunctionType function_type, bool* ok); | 834 FunctionLiteral::FunctionType function_type, bool* ok); |
836 | 835 |
837 V8_INLINE LazyParsingResult | 836 V8_INLINE LazyParsingResult |
838 SkipLazyFunctionBody(int* materialized_literal_count, | 837 SkipLazyFunctionBody(int* materialized_literal_count, |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
939 | 938 |
940 V8_INLINE PreParserExpression RewriteReturn(PreParserExpression return_value, | 939 V8_INLINE PreParserExpression RewriteReturn(PreParserExpression return_value, |
941 int pos) { | 940 int pos) { |
942 return return_value; | 941 return return_value; |
943 } | 942 } |
944 V8_INLINE PreParserStatement RewriteSwitchStatement( | 943 V8_INLINE PreParserStatement RewriteSwitchStatement( |
945 PreParserExpression tag, PreParserStatement switch_statement, | 944 PreParserExpression tag, PreParserStatement switch_statement, |
946 PreParserStatementList cases, Scope* scope) { | 945 PreParserStatementList cases, Scope* scope) { |
947 return PreParserStatement::Default(); | 946 return PreParserStatement::Default(); |
948 } | 947 } |
| 948 V8_INLINE void RewriteCatchPattern(CatchInfo* catch_info, bool* ok) {} |
| 949 V8_INLINE void ValidateCatchBlock(const CatchInfo& catch_info, bool* ok) {} |
| 950 V8_INLINE PreParserStatement RewriteTryStatement( |
| 951 PreParserStatement try_block, PreParserStatement catch_block, |
| 952 PreParserStatement finally_block, const CatchInfo& catch_info, int pos) { |
| 953 return PreParserStatement::Default(); |
| 954 } |
949 | 955 |
950 V8_INLINE PreParserExpression RewriteDoExpression(PreParserStatement body, | 956 V8_INLINE PreParserExpression RewriteDoExpression(PreParserStatement body, |
951 int pos, bool* ok) { | 957 int pos, bool* ok) { |
952 return PreParserExpression::Default(); | 958 return PreParserExpression::Default(); |
953 } | 959 } |
954 | 960 |
955 // TODO(nikolaos): The preparser currently does not keep track of labels | 961 // TODO(nikolaos): The preparser currently does not keep track of labels |
956 // and targets. | 962 // and targets. |
957 V8_INLINE PreParserStatement LookupBreakTarget(PreParserIdentifier label, | 963 V8_INLINE PreParserStatement LookupBreakTarget(PreParserIdentifier label, |
958 bool* ok) { | 964 bool* ok) { |
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1173 | 1179 |
1174 V8_INLINE static PreParserStatementList NullStatementList() { | 1180 V8_INLINE static PreParserStatementList NullStatementList() { |
1175 return PreParserStatementList::Null(); | 1181 return PreParserStatementList::Null(); |
1176 } | 1182 } |
1177 | 1183 |
1178 V8_INLINE static bool IsNullStatementList(PreParserStatementList stmts) { | 1184 V8_INLINE static bool IsNullStatementList(PreParserStatementList stmts) { |
1179 return stmts.IsNull(); | 1185 return stmts.IsNull(); |
1180 } | 1186 } |
1181 | 1187 |
1182 V8_INLINE static PreParserStatement NullStatement() { | 1188 V8_INLINE static PreParserStatement NullStatement() { |
1183 return PreParserStatement::Default(); | 1189 return PreParserStatement::Null(); |
1184 } | 1190 } |
1185 | 1191 |
1186 V8_INLINE bool IsNullStatement(PreParserStatement stmt) { | 1192 V8_INLINE bool IsNullStatement(PreParserStatement stmt) { |
1187 return stmt.IsNullStatement(); | 1193 return stmt.IsNullStatement(); |
1188 } | 1194 } |
1189 | 1195 |
1190 V8_INLINE bool IsEmptyStatement(PreParserStatement stmt) { | 1196 V8_INLINE bool IsEmptyStatement(PreParserStatement stmt) { |
1191 return stmt.IsEmptyStatement(); | 1197 return stmt.IsEmptyStatement(); |
1192 } | 1198 } |
1193 | 1199 |
1194 V8_INLINE static PreParserStatement NullBlock() { | 1200 V8_INLINE static PreParserStatement NullBlock() { |
1195 return PreParserStatement::Default(); | 1201 return PreParserStatement::Null(); |
1196 } | 1202 } |
1197 | 1203 |
1198 V8_INLINE PreParserIdentifier EmptyIdentifierString() const { | 1204 V8_INLINE PreParserIdentifier EmptyIdentifierString() const { |
1199 return PreParserIdentifier::Default(); | 1205 return PreParserIdentifier::Default(); |
1200 } | 1206 } |
1201 | 1207 |
1202 // Odd-ball literal creators. | 1208 // Odd-ball literal creators. |
1203 V8_INLINE PreParserExpression GetLiteralTheHole(int position) { | 1209 V8_INLINE PreParserExpression GetLiteralTheHole(int position) { |
1204 return PreParserExpression::Default(); | 1210 return PreParserExpression::Default(); |
1205 } | 1211 } |
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1406 function_state_->NextMaterializedLiteralIndex(); | 1412 function_state_->NextMaterializedLiteralIndex(); |
1407 function_state_->NextMaterializedLiteralIndex(); | 1413 function_state_->NextMaterializedLiteralIndex(); |
1408 } | 1414 } |
1409 return EmptyExpression(); | 1415 return EmptyExpression(); |
1410 } | 1416 } |
1411 | 1417 |
1412 } // namespace internal | 1418 } // namespace internal |
1413 } // namespace v8 | 1419 } // namespace v8 |
1414 | 1420 |
1415 #endif // V8_PARSING_PREPARSER_H | 1421 #endif // V8_PARSING_PREPARSER_H |
OLD | NEW |