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 920 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
931 PreParserExpression) {} | 931 PreParserExpression) {} |
932 | 932 |
933 inline void RewriteNonPattern(Type::ExpressionClassifier* classifier, | 933 inline void RewriteNonPattern(Type::ExpressionClassifier* classifier, |
934 bool* ok); | 934 bool* ok); |
935 | 935 |
936 V8_INLINE Zone* zone() const; | 936 V8_INLINE Zone* zone() const; |
937 V8_INLINE ZoneList<PreParserExpression>* GetNonPatternList() const; | 937 V8_INLINE ZoneList<PreParserExpression>* GetNonPatternList() const; |
938 | 938 |
939 inline PreParserExpression RewriteYieldStar( | 939 inline PreParserExpression RewriteYieldStar( |
940 PreParserExpression generator, PreParserExpression expr, int pos); | 940 PreParserExpression generator, PreParserExpression expr, int pos); |
| 941 inline PreParserExpression RewriteInstanceof(PreParserExpression lhs, |
| 942 PreParserExpression rhs, |
| 943 int pos); |
941 | 944 |
942 private: | 945 private: |
943 PreParser* pre_parser_; | 946 PreParser* pre_parser_; |
944 }; | 947 }; |
945 | 948 |
946 | 949 |
947 // Preparsing checks a JavaScript program and emits preparse-data that helps | 950 // Preparsing checks a JavaScript program and emits preparse-data that helps |
948 // a later parsing to be faster. | 951 // a later parsing to be faster. |
949 // See preparse-data-format.h for the data format. | 952 // See preparse-data-format.h for the data format. |
950 | 953 |
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1134 return pre_parser_->function_state_->non_patterns_to_rewrite(); | 1137 return pre_parser_->function_state_->non_patterns_to_rewrite(); |
1135 } | 1138 } |
1136 | 1139 |
1137 | 1140 |
1138 PreParserExpression PreParserTraits::RewriteYieldStar( | 1141 PreParserExpression PreParserTraits::RewriteYieldStar( |
1139 PreParserExpression generator, PreParserExpression expression, int pos) { | 1142 PreParserExpression generator, PreParserExpression expression, int pos) { |
1140 return pre_parser_->factory()->NewYield( | 1143 return pre_parser_->factory()->NewYield( |
1141 generator, expression, Yield::kDelegating, pos); | 1144 generator, expression, Yield::kDelegating, pos); |
1142 } | 1145 } |
1143 | 1146 |
| 1147 PreParserExpression PreParserTraits::RewriteInstanceof(PreParserExpression lhs, |
| 1148 PreParserExpression rhs, |
| 1149 int pos) { |
| 1150 return PreParserExpression::Default(); |
| 1151 } |
1144 | 1152 |
1145 PreParserStatementList PreParser::ParseEagerFunctionBody( | 1153 PreParserStatementList PreParser::ParseEagerFunctionBody( |
1146 PreParserIdentifier function_name, int pos, | 1154 PreParserIdentifier function_name, int pos, |
1147 const PreParserFormalParameters& parameters, FunctionKind kind, | 1155 const PreParserFormalParameters& parameters, FunctionKind kind, |
1148 FunctionLiteral::FunctionType function_type, bool* ok) { | 1156 FunctionLiteral::FunctionType function_type, bool* ok) { |
1149 ParsingModeScope parsing_mode(this, PARSE_EAGERLY); | 1157 ParsingModeScope parsing_mode(this, PARSE_EAGERLY); |
1150 | 1158 |
1151 ParseStatementList(Token::RBRACE, ok); | 1159 ParseStatementList(Token::RBRACE, ok); |
1152 if (!*ok) return PreParserStatementList(); | 1160 if (!*ok) return PreParserStatementList(); |
1153 | 1161 |
1154 Expect(Token::RBRACE, ok); | 1162 Expect(Token::RBRACE, ok); |
1155 return PreParserStatementList(); | 1163 return PreParserStatementList(); |
1156 } | 1164 } |
1157 | 1165 |
1158 | 1166 |
1159 PreParserStatementList PreParserTraits::ParseEagerFunctionBody( | 1167 PreParserStatementList PreParserTraits::ParseEagerFunctionBody( |
1160 PreParserIdentifier function_name, int pos, | 1168 PreParserIdentifier function_name, int pos, |
1161 const PreParserFormalParameters& parameters, FunctionKind kind, | 1169 const PreParserFormalParameters& parameters, FunctionKind kind, |
1162 FunctionLiteral::FunctionType function_type, bool* ok) { | 1170 FunctionLiteral::FunctionType function_type, bool* ok) { |
1163 return pre_parser_->ParseEagerFunctionBody(function_name, pos, parameters, | 1171 return pre_parser_->ParseEagerFunctionBody(function_name, pos, parameters, |
1164 kind, function_type, ok); | 1172 kind, function_type, ok); |
1165 } | 1173 } |
1166 | 1174 |
1167 } // namespace internal | 1175 } // namespace internal |
1168 } // namespace v8 | 1176 } // namespace v8 |
1169 | 1177 |
1170 #endif // V8_PARSING_PREPARSER_H | 1178 #endif // V8_PARSING_PREPARSER_H |
OLD | NEW |