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

Side by Side Diff: src/preparser.h

Issue 939063002: [strong] Deprecate for-in (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Comments Created 5 years, 10 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/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/v8.h" 8 #include "src/v8.h"
9 9
10 #include "src/bailout-reason.h" 10 #include "src/bailout-reason.h"
(...skipping 402 matching lines...) Expand 10 before | Expand all | Expand 10 after
413 413
414 void ExpectContextualKeyword(Vector<const char> keyword, bool* ok) { 414 void ExpectContextualKeyword(Vector<const char> keyword, bool* ok) {
415 Expect(Token::IDENTIFIER, ok); 415 Expect(Token::IDENTIFIER, ok);
416 if (!*ok) return; 416 if (!*ok) return;
417 if (!scanner()->is_literal_contextual_keyword(keyword)) { 417 if (!scanner()->is_literal_contextual_keyword(keyword)) {
418 ReportUnexpectedToken(scanner()->current_token()); 418 ReportUnexpectedToken(scanner()->current_token());
419 *ok = false; 419 *ok = false;
420 } 420 }
421 } 421 }
422 422
423 bool CheckInOrOf(
424 bool accept_OF, ForEachStatement::VisitMode* visit_mode, bool* ok) {
425 if (Check(Token::IN)) {
426 if (is_strong(language_mode())) {
427 ReportMessageAt(scanner()->location(), "strong_for_in");
428 *ok = false;
429 } else {
430 *visit_mode = ForEachStatement::ENUMERATE;
431 }
432 return true;
433 } else if (accept_OF && CheckContextualKeyword(CStrVector("of"))) {
434 *visit_mode = ForEachStatement::ITERATE;
435 return true;
436 }
437 return false;
438 }
439
423 // 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.
424 // 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.
425 void CheckOctalLiteral(int beg_pos, int end_pos, const char* error, 442 void CheckOctalLiteral(int beg_pos, int end_pos, const char* error,
426 bool* ok) { 443 bool* ok) {
427 Scanner::Location octal = scanner()->octal_position(); 444 Scanner::Location octal = scanner()->octal_position();
428 if (octal.IsValid() && beg_pos <= octal.beg_pos && 445 if (octal.IsValid() && beg_pos <= octal.beg_pos &&
429 octal.end_pos <= end_pos) { 446 octal.end_pos <= end_pos) {
430 ReportMessageAt(octal, error); 447 ReportMessageAt(octal, error);
431 scanner()->clear_octal_position(); 448 scanner()->clear_octal_position();
432 *ok = false; 449 *ok = false;
(...skipping 1173 matching lines...) Expand 10 before | Expand all | Expand 10 after
1606 Identifier name, Scanner::Location function_name_location, 1623 Identifier name, Scanner::Location function_name_location,
1607 bool name_is_strict_reserved, FunctionKind kind, int function_token_pos, 1624 bool name_is_strict_reserved, FunctionKind kind, int function_token_pos,
1608 FunctionLiteral::FunctionType function_type, 1625 FunctionLiteral::FunctionType function_type,
1609 FunctionLiteral::ArityRestriction arity_restriction, bool* ok); 1626 FunctionLiteral::ArityRestriction arity_restriction, bool* ok);
1610 void ParseLazyFunctionLiteralBody(bool* ok); 1627 void ParseLazyFunctionLiteralBody(bool* ok);
1611 1628
1612 PreParserExpression ParseClassLiteral(PreParserIdentifier name, 1629 PreParserExpression ParseClassLiteral(PreParserIdentifier name,
1613 Scanner::Location class_name_location, 1630 Scanner::Location class_name_location,
1614 bool name_is_strict_reserved, int pos, 1631 bool name_is_strict_reserved, int pos,
1615 bool* ok); 1632 bool* ok);
1616
1617 bool CheckInOrOf(bool accept_OF);
1618 }; 1633 };
1619 1634
1620 1635
1621 void PreParserTraits::MaterializeTemplateCallsiteLiterals() { 1636 void PreParserTraits::MaterializeTemplateCallsiteLiterals() {
1622 pre_parser_->function_state_->NextMaterializedLiteralIndex(); 1637 pre_parser_->function_state_->NextMaterializedLiteralIndex();
1623 pre_parser_->function_state_->NextMaterializedLiteralIndex(); 1638 pre_parser_->function_state_->NextMaterializedLiteralIndex();
1624 } 1639 }
1625 1640
1626 1641
1627 PreParserStatementList PreParser::ParseEagerFunctionBody( 1642 PreParserStatementList PreParser::ParseEagerFunctionBody(
(...skipping 1455 matching lines...) Expand 10 before | Expand all | Expand 10 after
3083 *ok = false; 3098 *ok = false;
3084 return; 3099 return;
3085 } 3100 }
3086 has_seen_constructor_ = true; 3101 has_seen_constructor_ = true;
3087 return; 3102 return;
3088 } 3103 }
3089 } 3104 }
3090 } } // v8::internal 3105 } } // v8::internal
3091 3106
3092 #endif // V8_PREPARSER_H 3107 #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