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/bailout-reason.h" | 9 #include "src/bailout-reason.h" |
10 #include "src/hashmap.h" | 10 #include "src/hashmap.h" |
(...skipping 928 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
939 void SetFunctionNameFromIdentifierRef(PreParserExpression, | 939 void SetFunctionNameFromIdentifierRef(PreParserExpression, |
940 PreParserExpression) {} | 940 PreParserExpression) {} |
941 | 941 |
942 inline PreParserExpression RewriteNonPattern( | 942 inline PreParserExpression RewriteNonPattern( |
943 PreParserExpression expr, const ExpressionClassifier* classifier, | 943 PreParserExpression expr, const ExpressionClassifier* classifier, |
944 bool* ok); | 944 bool* ok); |
945 inline PreParserExpression RewriteNonPatternObjectLiteralProperty( | 945 inline PreParserExpression RewriteNonPatternObjectLiteralProperty( |
946 PreParserExpression property, const ExpressionClassifier* classifier, | 946 PreParserExpression property, const ExpressionClassifier* classifier, |
947 bool* ok); | 947 bool* ok); |
948 | 948 |
| 949 inline PreParserExpression RewriteYieldStar( |
| 950 PreParserExpression generator, PreParserExpression expr, int pos); |
| 951 |
949 private: | 952 private: |
950 PreParser* pre_parser_; | 953 PreParser* pre_parser_; |
951 }; | 954 }; |
952 | 955 |
953 | 956 |
954 // Preparsing checks a JavaScript program and emits preparse-data that helps | 957 // Preparsing checks a JavaScript program and emits preparse-data that helps |
955 // a later parsing to be faster. | 958 // a later parsing to be faster. |
956 // See preparse-data-format.h for the data format. | 959 // See preparse-data-format.h for the data format. |
957 | 960 |
958 // The PreParser checks that the syntax follows the grammar for JavaScript, | 961 // The PreParser checks that the syntax follows the grammar for JavaScript, |
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1136 | 1139 |
1137 | 1140 |
1138 PreParserExpression PreParserTraits::RewriteNonPatternObjectLiteralProperty( | 1141 PreParserExpression PreParserTraits::RewriteNonPatternObjectLiteralProperty( |
1139 PreParserExpression property, const ExpressionClassifier* classifier, | 1142 PreParserExpression property, const ExpressionClassifier* classifier, |
1140 bool* ok) { | 1143 bool* ok) { |
1141 pre_parser_->ValidateExpression(classifier, ok); | 1144 pre_parser_->ValidateExpression(classifier, ok); |
1142 return property; | 1145 return property; |
1143 } | 1146 } |
1144 | 1147 |
1145 | 1148 |
| 1149 PreParserExpression PreParserTraits::RewriteYieldStar( |
| 1150 PreParserExpression generator, PreParserExpression expression, int pos) { |
| 1151 return pre_parser_->factory()->NewYield( |
| 1152 generator, expression, Yield::kDelegating, pos); |
| 1153 } |
| 1154 |
| 1155 |
1146 PreParserStatementList PreParser::ParseEagerFunctionBody( | 1156 PreParserStatementList PreParser::ParseEagerFunctionBody( |
1147 PreParserIdentifier function_name, int pos, | 1157 PreParserIdentifier function_name, int pos, |
1148 const PreParserFormalParameters& parameters, FunctionKind kind, | 1158 const PreParserFormalParameters& parameters, FunctionKind kind, |
1149 FunctionLiteral::FunctionType function_type, bool* ok) { | 1159 FunctionLiteral::FunctionType function_type, bool* ok) { |
1150 ParsingModeScope parsing_mode(this, PARSE_EAGERLY); | 1160 ParsingModeScope parsing_mode(this, PARSE_EAGERLY); |
1151 | 1161 |
1152 ParseStatementList(Token::RBRACE, ok); | 1162 ParseStatementList(Token::RBRACE, ok); |
1153 if (!*ok) return PreParserStatementList(); | 1163 if (!*ok) return PreParserStatementList(); |
1154 | 1164 |
1155 Expect(Token::RBRACE, ok); | 1165 Expect(Token::RBRACE, ok); |
1156 return PreParserStatementList(); | 1166 return PreParserStatementList(); |
1157 } | 1167 } |
1158 | 1168 |
1159 | 1169 |
1160 PreParserStatementList PreParserTraits::ParseEagerFunctionBody( | 1170 PreParserStatementList PreParserTraits::ParseEagerFunctionBody( |
1161 PreParserIdentifier function_name, int pos, | 1171 PreParserIdentifier function_name, int pos, |
1162 const PreParserFormalParameters& parameters, FunctionKind kind, | 1172 const PreParserFormalParameters& parameters, FunctionKind kind, |
1163 FunctionLiteral::FunctionType function_type, bool* ok) { | 1173 FunctionLiteral::FunctionType function_type, bool* ok) { |
1164 return pre_parser_->ParseEagerFunctionBody(function_name, pos, parameters, | 1174 return pre_parser_->ParseEagerFunctionBody(function_name, pos, parameters, |
1165 kind, function_type, ok); | 1175 kind, function_type, ok); |
1166 } | 1176 } |
1167 | 1177 |
1168 } // namespace internal | 1178 } // namespace internal |
1169 } // namespace v8 | 1179 } // namespace v8 |
1170 | 1180 |
1171 #endif // V8_PARSING_PREPARSER_H | 1181 #endif // V8_PARSING_PREPARSER_H |
OLD | NEW |