OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 #include <cmath> | 5 #include <cmath> |
6 | 6 |
7 #include "src/allocation.h" | 7 #include "src/allocation.h" |
8 #include "src/base/logging.h" | 8 #include "src/base/logging.h" |
9 #include "src/conversions-inl.h" | 9 #include "src/conversions-inl.h" |
10 #include "src/conversions.h" | 10 #include "src/conversions.h" |
(...skipping 1150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1161 // TODO(marja): Make PreParser use scope names too. | 1161 // TODO(marja): Make PreParser use scope names too. |
1162 // this->scope()->SetScopeName(name); | 1162 // this->scope()->SetScopeName(name); |
1163 | 1163 |
1164 bool has_extends = Check(Token::EXTENDS); | 1164 bool has_extends = Check(Token::EXTENDS); |
1165 if (has_extends) { | 1165 if (has_extends) { |
1166 ExpressionClassifier extends_classifier(this); | 1166 ExpressionClassifier extends_classifier(this); |
1167 ParseLeftHandSideExpression(&extends_classifier, CHECK_OK); | 1167 ParseLeftHandSideExpression(&extends_classifier, CHECK_OK); |
1168 CheckNoTailCallExpressions(&extends_classifier, CHECK_OK); | 1168 CheckNoTailCallExpressions(&extends_classifier, CHECK_OK); |
1169 ValidateExpression(&extends_classifier, CHECK_OK); | 1169 ValidateExpression(&extends_classifier, CHECK_OK); |
1170 if (classifier != nullptr) { | 1170 if (classifier != nullptr) { |
1171 classifier->Accumulate(&extends_classifier, | 1171 classifier->AccumulateFormalParameterContainmentErrors( |
1172 ExpressionClassifier::ExpressionProductions); | 1172 &extends_classifier); |
1173 } | 1173 } |
1174 } | 1174 } |
1175 | 1175 |
1176 ClassLiteralChecker checker(this); | 1176 ClassLiteralChecker checker(this); |
1177 bool has_seen_constructor = false; | 1177 bool has_seen_constructor = false; |
1178 | 1178 |
1179 Expect(Token::LBRACE, CHECK_OK); | 1179 Expect(Token::LBRACE, CHECK_OK); |
1180 while (peek() != Token::RBRACE) { | 1180 while (peek() != Token::RBRACE) { |
1181 if (Check(Token::SEMICOLON)) continue; | 1181 if (Check(Token::SEMICOLON)) continue; |
1182 const bool in_class = true; | 1182 const bool in_class = true; |
1183 bool is_computed_name = false; // Classes do not care about computed | 1183 bool is_computed_name = false; // Classes do not care about computed |
1184 // property names here. | 1184 // property names here. |
1185 Identifier name; | 1185 Identifier name; |
1186 ExpressionClassifier property_classifier(this); | 1186 ExpressionClassifier property_classifier(this); |
1187 ParsePropertyDefinition( | 1187 ParsePropertyDefinition( |
1188 &checker, in_class, has_extends, MethodKind::kNormal, &is_computed_name, | 1188 &checker, in_class, has_extends, MethodKind::kNormal, &is_computed_name, |
1189 &has_seen_constructor, &property_classifier, &name, CHECK_OK); | 1189 &has_seen_constructor, &property_classifier, &name, CHECK_OK); |
1190 ValidateExpression(&property_classifier, CHECK_OK); | 1190 ValidateExpression(&property_classifier, CHECK_OK); |
1191 if (classifier != nullptr) { | 1191 if (classifier != nullptr) { |
1192 classifier->Accumulate(&property_classifier, | 1192 classifier->AccumulateFormalParameterContainmentErrors( |
1193 ExpressionClassifier::ExpressionProductions); | 1193 &property_classifier); |
1194 } | 1194 } |
1195 } | 1195 } |
1196 | 1196 |
1197 Expect(Token::RBRACE, CHECK_OK); | 1197 Expect(Token::RBRACE, CHECK_OK); |
1198 | 1198 |
1199 return Expression::Default(); | 1199 return Expression::Default(); |
1200 } | 1200 } |
1201 | 1201 |
1202 | 1202 |
1203 PreParser::Expression PreParser::ParseV8Intrinsic(bool* ok) { | 1203 PreParser::Expression PreParser::ParseV8Intrinsic(bool* ok) { |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1243 | 1243 |
1244 body->Add(PreParserStatement::ExpressionStatement(return_value), zone()); | 1244 body->Add(PreParserStatement::ExpressionStatement(return_value), zone()); |
1245 } | 1245 } |
1246 | 1246 |
1247 #undef CHECK_OK | 1247 #undef CHECK_OK |
1248 #undef CHECK_OK_CUSTOM | 1248 #undef CHECK_OK_CUSTOM |
1249 | 1249 |
1250 | 1250 |
1251 } // namespace internal | 1251 } // namespace internal |
1252 } // namespace v8 | 1252 } // namespace v8 |
OLD | NEW |