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 bool* ok) { | |
marja
2016/09/14 10:06:59
Now this code is in both Parser and PreParser; wha
nickie
2016/09/14 10:19:09
Well, for some weird reason, in the two implementa
marja
2016/09/14 11:00:27
I think that should get figured out before landing
nickie
2016/09/14 11:43:08
Done. (As discussed offline.)
| |
954 if (FLAG_harmony_explicit_tailcalls && !catch_block.IsNullStatement() && | |
955 catch_info.tail_call_expressions.has_explicit_tail_calls()) { | |
956 // TODO(ishell): update chapter number. | |
957 // ES8 XX.YY.ZZ | |
958 ReportMessageAt(catch_info.tail_call_expressions.location(), | |
959 MessageTemplate::kUnexpectedTailCallInCatchBlock); | |
960 *ok = false; | |
961 } | |
962 return PreParserStatement::Default(); | |
963 } | |
949 | 964 |
950 V8_INLINE PreParserExpression RewriteDoExpression(PreParserStatement body, | 965 V8_INLINE PreParserExpression RewriteDoExpression(PreParserStatement body, |
951 int pos, bool* ok) { | 966 int pos, bool* ok) { |
952 return PreParserExpression::Default(); | 967 return PreParserExpression::Default(); |
953 } | 968 } |
954 | 969 |
955 // TODO(nikolaos): The preparser currently does not keep track of labels | 970 // TODO(nikolaos): The preparser currently does not keep track of labels |
956 // and targets. | 971 // and targets. |
957 V8_INLINE PreParserStatement LookupBreakTarget(PreParserIdentifier label, | 972 V8_INLINE PreParserStatement LookupBreakTarget(PreParserIdentifier label, |
958 bool* ok) { | 973 bool* ok) { |
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1173 | 1188 |
1174 V8_INLINE static PreParserStatementList NullStatementList() { | 1189 V8_INLINE static PreParserStatementList NullStatementList() { |
1175 return PreParserStatementList::Null(); | 1190 return PreParserStatementList::Null(); |
1176 } | 1191 } |
1177 | 1192 |
1178 V8_INLINE static bool IsNullStatementList(PreParserStatementList stmts) { | 1193 V8_INLINE static bool IsNullStatementList(PreParserStatementList stmts) { |
1179 return stmts.IsNull(); | 1194 return stmts.IsNull(); |
1180 } | 1195 } |
1181 | 1196 |
1182 V8_INLINE static PreParserStatement NullStatement() { | 1197 V8_INLINE static PreParserStatement NullStatement() { |
1183 return PreParserStatement::Default(); | 1198 return PreParserStatement::Null(); |
1184 } | 1199 } |
1185 | 1200 |
1186 V8_INLINE bool IsNullStatement(PreParserStatement stmt) { | 1201 V8_INLINE bool IsNullStatement(PreParserStatement stmt) { |
1187 return stmt.IsNullStatement(); | 1202 return stmt.IsNullStatement(); |
1188 } | 1203 } |
1189 | 1204 |
1190 V8_INLINE bool IsEmptyStatement(PreParserStatement stmt) { | 1205 V8_INLINE bool IsEmptyStatement(PreParserStatement stmt) { |
1191 return stmt.IsEmptyStatement(); | 1206 return stmt.IsEmptyStatement(); |
1192 } | 1207 } |
1193 | 1208 |
1194 V8_INLINE static PreParserStatement NullBlock() { | 1209 V8_INLINE static PreParserStatement NullBlock() { |
1195 return PreParserStatement::Default(); | 1210 return PreParserStatement::Null(); |
1196 } | 1211 } |
1197 | 1212 |
1198 V8_INLINE PreParserIdentifier EmptyIdentifierString() const { | 1213 V8_INLINE PreParserIdentifier EmptyIdentifierString() const { |
1199 return PreParserIdentifier::Default(); | 1214 return PreParserIdentifier::Default(); |
1200 } | 1215 } |
1201 | 1216 |
1202 // Odd-ball literal creators. | 1217 // Odd-ball literal creators. |
1203 V8_INLINE PreParserExpression GetLiteralTheHole(int position) { | 1218 V8_INLINE PreParserExpression GetLiteralTheHole(int position) { |
1204 return PreParserExpression::Default(); | 1219 return PreParserExpression::Default(); |
1205 } | 1220 } |
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1406 function_state_->NextMaterializedLiteralIndex(); | 1421 function_state_->NextMaterializedLiteralIndex(); |
1407 function_state_->NextMaterializedLiteralIndex(); | 1422 function_state_->NextMaterializedLiteralIndex(); |
1408 } | 1423 } |
1409 return EmptyExpression(); | 1424 return EmptyExpression(); |
1410 } | 1425 } |
1411 | 1426 |
1412 } // namespace internal | 1427 } // namespace internal |
1413 } // namespace v8 | 1428 } // namespace v8 |
1414 | 1429 |
1415 #endif // V8_PARSING_PREPARSER_H | 1430 #endif // V8_PARSING_PREPARSER_H |
OLD | NEW |