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

Side by Side Diff: src/preparser.h

Issue 1411873004: [es6] allow any LeftHandSideExpression in for-of loops (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fix bug in loop-assignment-analyzer which resulted in incorrect code Created 5 years, 1 month 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/parser.cc ('k') | src/preparser.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 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_PREPARSER_H 5 #ifndef V8_PREPARSER_H
6 #define V8_PREPARSER_H 6 #define V8_PREPARSER_H
7 7
8 #include "src/bailout-reason.h" 8 #include "src/bailout-reason.h"
9 #include "src/expression-classifier.h" 9 #include "src/expression-classifier.h"
10 #include "src/func-name-inferrer.h" 10 #include "src/func-name-inferrer.h"
(...skipping 403 matching lines...) Expand 10 before | Expand all | Expand 10 after
414 414
415 void ExpectContextualKeyword(Vector<const char> keyword, bool* ok) { 415 void ExpectContextualKeyword(Vector<const char> keyword, bool* ok) {
416 Expect(Token::IDENTIFIER, ok); 416 Expect(Token::IDENTIFIER, ok);
417 if (!*ok) return; 417 if (!*ok) return;
418 if (!scanner()->is_literal_contextual_keyword(keyword)) { 418 if (!scanner()->is_literal_contextual_keyword(keyword)) {
419 ReportUnexpectedToken(scanner()->current_token()); 419 ReportUnexpectedToken(scanner()->current_token());
420 *ok = false; 420 *ok = false;
421 } 421 }
422 } 422 }
423 423
424 bool CheckInOrOf( 424 bool CheckInOrOf(ForEachStatement::VisitMode* visit_mode, bool* ok) {
425 bool accept_OF, ForEachStatement::VisitMode* visit_mode, bool* ok) {
426 if (Check(Token::IN)) { 425 if (Check(Token::IN)) {
427 if (is_strong(language_mode())) { 426 if (is_strong(language_mode())) {
428 ReportMessageAt(scanner()->location(), MessageTemplate::kStrongForIn); 427 ReportMessageAt(scanner()->location(), MessageTemplate::kStrongForIn);
429 *ok = false; 428 *ok = false;
430 } else { 429 } else {
431 *visit_mode = ForEachStatement::ENUMERATE; 430 *visit_mode = ForEachStatement::ENUMERATE;
432 } 431 }
433 return true; 432 return true;
434 } else if (accept_OF && CheckContextualKeyword(CStrVector("of"))) { 433 } else if (CheckContextualKeyword(CStrVector("of"))) {
435 *visit_mode = ForEachStatement::ITERATE; 434 *visit_mode = ForEachStatement::ITERATE;
436 return true; 435 return true;
437 } 436 }
438 return false; 437 return false;
439 } 438 }
440 439
441 // Checks whether an octal literal was last seen between beg_pos and end_pos. 440 // Checks whether an octal literal was last seen between beg_pos and end_pos.
442 // If so, reports an error. Only called for strict mode and template strings. 441 // If so, reports an error. Only called for strict mode and template strings.
443 void CheckOctalLiteral(int beg_pos, int end_pos, 442 void CheckOctalLiteral(int beg_pos, int end_pos,
444 MessageTemplate::Template message, bool* ok) { 443 MessageTemplate::Template message, bool* ok) {
(...skipping 3777 matching lines...) Expand 10 before | Expand all | Expand 10 after
4222 return; 4221 return;
4223 } 4222 }
4224 has_seen_constructor_ = true; 4223 has_seen_constructor_ = true;
4225 return; 4224 return;
4226 } 4225 }
4227 } 4226 }
4228 } // namespace internal 4227 } // namespace internal
4229 } // namespace v8 4228 } // namespace v8
4230 4229
4231 #endif // V8_PREPARSER_H 4230 #endif // V8_PREPARSER_H
OLDNEW
« no previous file with comments | « src/parser.cc ('k') | src/preparser.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698