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

Side by Side Diff: src/preparser.h

Issue 1161243005: Revert of [es6] Super call in arrows and eval (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 6 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/pattern-rewriter.cc ('k') | src/prettyprinter.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 1697 matching lines...) Expand 10 before | Expand all | Expand 10 after
1708 static PreParserIdentifier GetNextSymbol(Scanner* scanner) { 1708 static PreParserIdentifier GetNextSymbol(Scanner* scanner) {
1709 return PreParserIdentifier::Default(); 1709 return PreParserIdentifier::Default();
1710 } 1710 }
1711 1711
1712 static PreParserExpression ThisExpression(Scope* scope, 1712 static PreParserExpression ThisExpression(Scope* scope,
1713 PreParserFactory* factory, 1713 PreParserFactory* factory,
1714 int pos) { 1714 int pos) {
1715 return PreParserExpression::This(); 1715 return PreParserExpression::This();
1716 } 1716 }
1717 1717
1718 static PreParserExpression SuperPropertyReference(Scope* scope, 1718 static PreParserExpression SuperReference(Scope* scope,
1719 PreParserFactory* factory, 1719 PreParserFactory* factory,
1720 int pos) { 1720 int pos) {
1721 return PreParserExpression::Default(); 1721 return PreParserExpression::Default();
1722 } 1722 }
1723 1723
1724 static PreParserExpression SuperCallReference(Scope* scope,
1725 PreParserFactory* factory,
1726 int pos) {
1727 return PreParserExpression::Default();
1728 }
1729
1730 static PreParserExpression DefaultConstructor(bool call_super, Scope* scope, 1724 static PreParserExpression DefaultConstructor(bool call_super, Scope* scope,
1731 int pos, int end_pos) { 1725 int pos, int end_pos) {
1732 return PreParserExpression::Default(); 1726 return PreParserExpression::Default();
1733 } 1727 }
1734 1728
1735 static PreParserExpression ExpressionFromLiteral( 1729 static PreParserExpression ExpressionFromLiteral(
1736 Token::Value token, int pos, Scanner* scanner, 1730 Token::Value token, int pos, Scanner* scanner,
1737 PreParserFactory* factory) { 1731 PreParserFactory* factory) {
1738 return PreParserExpression::Default(); 1732 return PreParserExpression::Default();
1739 } 1733 }
(...skipping 1774 matching lines...) Expand 10 before | Expand all | Expand 10 after
3514 typename ParserBase<Traits>::ExpressionT 3508 typename ParserBase<Traits>::ExpressionT
3515 ParserBase<Traits>::ParseStrongSuperCallExpression( 3509 ParserBase<Traits>::ParseStrongSuperCallExpression(
3516 ExpressionClassifier* classifier, bool* ok) { 3510 ExpressionClassifier* classifier, bool* ok) {
3517 // SuperCallExpression :: (strong mode) 3511 // SuperCallExpression :: (strong mode)
3518 // 'super' '(' ExpressionList ')' 3512 // 'super' '(' ExpressionList ')'
3519 BindingPatternUnexpectedToken(classifier); 3513 BindingPatternUnexpectedToken(classifier);
3520 3514
3521 Consume(Token::SUPER); 3515 Consume(Token::SUPER);
3522 int pos = position(); 3516 int pos = position();
3523 Scanner::Location super_loc = scanner()->location(); 3517 Scanner::Location super_loc = scanner()->location();
3524 ExpressionT expr = this->SuperCallReference(scope_, factory(), pos); 3518 ExpressionT expr = this->SuperReference(scope_, factory(), pos);
3525 3519
3526 if (peek() != Token::LPAREN) { 3520 if (peek() != Token::LPAREN) {
3527 ReportMessage(MessageTemplate::kStrongConstructorSuper); 3521 ReportMessage(MessageTemplate::kStrongConstructorSuper);
3528 *ok = false; 3522 *ok = false;
3529 return this->EmptyExpression(); 3523 return this->EmptyExpression();
3530 } 3524 }
3531 3525
3532 Scanner::Location spread_pos; 3526 Scanner::Location spread_pos;
3533 typename Traits::Type::ExpressionList args = 3527 typename Traits::Type::ExpressionList args =
3534 ParseArguments(&spread_pos, classifier, CHECK_OK); 3528 ParseArguments(&spread_pos, classifier, CHECK_OK);
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
3579 scope = scope->outer_scope(); 3573 scope = scope->outer_scope();
3580 DCHECK_NOT_NULL(scope); 3574 DCHECK_NOT_NULL(scope);
3581 scope = scope->DeclarationScope(); 3575 scope = scope->DeclarationScope();
3582 } 3576 }
3583 3577
3584 FunctionKind kind = scope->function_kind(); 3578 FunctionKind kind = scope->function_kind();
3585 if (IsConciseMethod(kind) || IsAccessorFunction(kind) || 3579 if (IsConciseMethod(kind) || IsAccessorFunction(kind) ||
3586 i::IsConstructor(kind)) { 3580 i::IsConstructor(kind)) {
3587 if (peek() == Token::PERIOD || peek() == Token::LBRACK) { 3581 if (peek() == Token::PERIOD || peek() == Token::LBRACK) {
3588 scope->RecordSuperPropertyUsage(); 3582 scope->RecordSuperPropertyUsage();
3589 return this->SuperPropertyReference(scope_, factory(), pos); 3583 return this->SuperReference(scope_, factory(), pos);
3590 } 3584 }
3591 // new super() is never allowed. 3585 // new super() is never allowed.
3592 // super() is only allowed in derived constructor 3586 // super() is only allowed in derived constructor
3593 if (!is_new && peek() == Token::LPAREN && IsSubclassConstructor(kind)) { 3587 if (!is_new && peek() == Token::LPAREN && IsSubclassConstructor(kind)) {
3594 if (is_strong(language_mode())) { 3588 if (is_strong(language_mode())) {
3595 // Super calls in strong mode are parsed separately. 3589 // Super calls in strong mode are parsed separately.
3596 ReportMessageAt(scanner()->location(), 3590 ReportMessageAt(scanner()->location(),
3597 MessageTemplate::kStrongConstructorSuper); 3591 MessageTemplate::kStrongConstructorSuper);
3598 *ok = false; 3592 *ok = false;
3599 return this->EmptyExpression(); 3593 return this->EmptyExpression();
3600 } 3594 }
3601 // TODO(rossberg): This might not be the correct FunctionState for the 3595 // TODO(rossberg): This might not be the correct FunctionState for the
3602 // method here. 3596 // method here.
3603 function_state_->set_super_location(scanner()->location()); 3597 function_state_->set_super_location(scanner()->location());
3604 return this->SuperCallReference(scope_, factory(), pos); 3598 return this->SuperReference(scope_, factory(), pos);
3605 } 3599 }
3606 } 3600 }
3607 3601
3608 ReportMessageAt(scanner()->location(), MessageTemplate::kUnexpectedSuper); 3602 ReportMessageAt(scanner()->location(), MessageTemplate::kUnexpectedSuper);
3609 *ok = false; 3603 *ok = false;
3610 return this->EmptyExpression(); 3604 return this->EmptyExpression();
3611 } 3605 }
3612 3606
3613 3607
3614 template <class Traits> 3608 template <class Traits>
(...skipping 430 matching lines...) Expand 10 before | Expand all | Expand 10 after
4045 *ok = false; 4039 *ok = false;
4046 return; 4040 return;
4047 } 4041 }
4048 has_seen_constructor_ = true; 4042 has_seen_constructor_ = true;
4049 return; 4043 return;
4050 } 4044 }
4051 } 4045 }
4052 } } // v8::internal 4046 } } // v8::internal
4053 4047
4054 #endif // V8_PREPARSER_H 4048 #endif // V8_PREPARSER_H
OLDNEW
« no previous file with comments | « src/pattern-rewriter.cc ('k') | src/prettyprinter.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698