Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(501)

Side by Side Diff: src/parsing/preparser.cc

Issue 1949223002: Disallow yield in computed property names of class expressions in params (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Added a few more tests Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/parsing/parser.cc ('k') | test/cctest/test-parsing.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 1158 matching lines...) Expand 10 before | Expand all | Expand 10 after
1169 bool has_seen_constructor = false; 1169 bool has_seen_constructor = false;
1170 1170
1171 Expect(Token::LBRACE, CHECK_OK); 1171 Expect(Token::LBRACE, CHECK_OK);
1172 while (peek() != Token::RBRACE) { 1172 while (peek() != Token::RBRACE) {
1173 if (Check(Token::SEMICOLON)) continue; 1173 if (Check(Token::SEMICOLON)) continue;
1174 const bool in_class = true; 1174 const bool in_class = true;
1175 const bool is_static = false; 1175 const bool is_static = false;
1176 bool is_computed_name = false; // Classes do not care about computed 1176 bool is_computed_name = false; // Classes do not care about computed
1177 // property names here. 1177 // property names here.
1178 Identifier name; 1178 Identifier name;
1179 ExpressionClassifier classifier(this); 1179 ExpressionClassifier property_classifier(this);
1180 ParsePropertyDefinition(&checker, in_class, has_extends, is_static, 1180 ParsePropertyDefinition(&checker, in_class, has_extends, is_static,
1181 &is_computed_name, &has_seen_constructor, 1181 &is_computed_name, &has_seen_constructor,
1182 &classifier, &name, CHECK_OK); 1182 &property_classifier, &name, CHECK_OK);
1183 ValidateExpression(&classifier, CHECK_OK); 1183 ValidateExpression(&property_classifier, CHECK_OK);
1184 if (classifier != nullptr) {
1185 classifier->Accumulate(&property_classifier,
1186 ExpressionClassifier::ExpressionProductions);
1187 }
1184 } 1188 }
1185 1189
1186 Expect(Token::RBRACE, CHECK_OK); 1190 Expect(Token::RBRACE, CHECK_OK);
1187 1191
1188 return Expression::Default(); 1192 return Expression::Default();
1189 } 1193 }
1190 1194
1191 1195
1192 PreParser::Expression PreParser::ParseV8Intrinsic(bool* ok) { 1196 PreParser::Expression PreParser::ParseV8Intrinsic(bool* ok) {
1193 // CallRuntime :: 1197 // CallRuntime ::
(...skipping 26 matching lines...) Expand all
1220 } 1224 }
1221 Expect(Token::RBRACE, CHECK_OK); 1225 Expect(Token::RBRACE, CHECK_OK);
1222 return PreParserExpression::Default(); 1226 return PreParserExpression::Default();
1223 } 1227 }
1224 1228
1225 #undef CHECK_OK 1229 #undef CHECK_OK
1226 1230
1227 1231
1228 } // namespace internal 1232 } // namespace internal
1229 } // namespace v8 1233 } // namespace v8
OLDNEW
« no previous file with comments | « src/parsing/parser.cc ('k') | test/cctest/test-parsing.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698