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 PreParserExpressionList args, | 931 PreParserExpressionList args, |
932 int pos); | 932 int pos); |
933 | 933 |
934 inline void RewriteDestructuringAssignments() {} | 934 inline void RewriteDestructuringAssignments() {} |
935 | 935 |
936 inline void QueueDestructuringAssignmentForRewriting(PreParserExpression) {} | 936 inline void QueueDestructuringAssignmentForRewriting(PreParserExpression) {} |
937 | 937 |
938 void SetFunctionNameFromPropertyName(PreParserExpression, | 938 void SetFunctionNameFromPropertyName(PreParserExpression, |
939 PreParserIdentifier) {} | 939 PreParserIdentifier) {} |
940 | 940 |
941 inline PreParserExpression RewriteExpression(PreParserExpression expr) { | 941 inline PreParserExpression RewriteExpression( |
942 return expr; | 942 PreParserExpression expr, const ExpressionClassifier* classifier, |
943 } | 943 bool* ok); |
944 inline PreParserExpression RewriteObjectLiteralProperty( | 944 inline PreParserExpression RewriteObjectLiteralProperty( |
945 PreParserExpression property) { | 945 PreParserExpression property, const ExpressionClassifier* classifier, |
946 return property; | 946 bool* ok); |
947 } | |
948 | 947 |
949 private: | 948 private: |
950 PreParser* pre_parser_; | 949 PreParser* pre_parser_; |
951 }; | 950 }; |
952 | 951 |
953 | 952 |
954 // Preparsing checks a JavaScript program and emits preparse-data that helps | 953 // Preparsing checks a JavaScript program and emits preparse-data that helps |
955 // a later parsing to be faster. | 954 // a later parsing to be faster. |
956 // See preparse-data-format.h for the data format. | 955 // See preparse-data-format.h for the data format. |
957 | 956 |
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1120 // TODO(wingo): Detect duplicated identifiers in paramlists. Detect parameter | 1119 // TODO(wingo): Detect duplicated identifiers in paramlists. Detect parameter |
1121 // lists that are too long. | 1120 // lists that are too long. |
1122 } | 1121 } |
1123 | 1122 |
1124 | 1123 |
1125 PreParserExpression PreParserTraits::ParseDoExpression(bool* ok) { | 1124 PreParserExpression PreParserTraits::ParseDoExpression(bool* ok) { |
1126 return pre_parser_->ParseDoExpression(ok); | 1125 return pre_parser_->ParseDoExpression(ok); |
1127 } | 1126 } |
1128 | 1127 |
1129 | 1128 |
| 1129 PreParserExpression PreParserTraits::RewriteExpression( |
| 1130 PreParserExpression expr, const ExpressionClassifier* classifier, |
| 1131 bool* ok) { |
| 1132 pre_parser_->ValidateExpression(classifier, ok); |
| 1133 return expr; |
| 1134 } |
| 1135 |
| 1136 |
| 1137 PreParserExpression PreParserTraits::RewriteObjectLiteralProperty( |
| 1138 PreParserExpression property, const ExpressionClassifier* classifier, |
| 1139 bool* ok) { |
| 1140 pre_parser_->ValidateExpression(classifier, ok); |
| 1141 return property; |
| 1142 } |
| 1143 |
| 1144 |
1130 PreParserStatementList PreParser::ParseEagerFunctionBody( | 1145 PreParserStatementList PreParser::ParseEagerFunctionBody( |
1131 PreParserIdentifier function_name, int pos, | 1146 PreParserIdentifier function_name, int pos, |
1132 const PreParserFormalParameters& parameters, FunctionKind kind, | 1147 const PreParserFormalParameters& parameters, FunctionKind kind, |
1133 FunctionLiteral::FunctionType function_type, bool* ok) { | 1148 FunctionLiteral::FunctionType function_type, bool* ok) { |
1134 ParsingModeScope parsing_mode(this, PARSE_EAGERLY); | 1149 ParsingModeScope parsing_mode(this, PARSE_EAGERLY); |
1135 | 1150 |
1136 ParseStatementList(Token::RBRACE, ok); | 1151 ParseStatementList(Token::RBRACE, ok); |
1137 if (!*ok) return PreParserStatementList(); | 1152 if (!*ok) return PreParserStatementList(); |
1138 | 1153 |
1139 Expect(Token::RBRACE, ok); | 1154 Expect(Token::RBRACE, ok); |
1140 return PreParserStatementList(); | 1155 return PreParserStatementList(); |
1141 } | 1156 } |
1142 | 1157 |
1143 | 1158 |
1144 PreParserStatementList PreParserTraits::ParseEagerFunctionBody( | 1159 PreParserStatementList PreParserTraits::ParseEagerFunctionBody( |
1145 PreParserIdentifier function_name, int pos, | 1160 PreParserIdentifier function_name, int pos, |
1146 const PreParserFormalParameters& parameters, FunctionKind kind, | 1161 const PreParserFormalParameters& parameters, FunctionKind kind, |
1147 FunctionLiteral::FunctionType function_type, bool* ok) { | 1162 FunctionLiteral::FunctionType function_type, bool* ok) { |
1148 return pre_parser_->ParseEagerFunctionBody(function_name, pos, parameters, | 1163 return pre_parser_->ParseEagerFunctionBody(function_name, pos, parameters, |
1149 kind, function_type, ok); | 1164 kind, function_type, ok); |
1150 } | 1165 } |
1151 | 1166 |
1152 } // namespace internal | 1167 } // namespace internal |
1153 } // namespace v8 | 1168 } // namespace v8 |
1154 | 1169 |
1155 #endif // V8_PARSING_PREPARSER_H | 1170 #endif // V8_PARSING_PREPARSER_H |
OLD | NEW |