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

Unified Diff: src/preparser.h

Issue 766663003: harmony-classes: Implement 'super(...)' call syntactic restriction. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Patch for landing Created 6 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 side-by-side diff with in-line comments
Download patch
Index: src/preparser.h
diff --git a/src/preparser.h b/src/preparser.h
index bdab177585bb05902be2d9c772132c82cf54fd82..b50019c0e406c7822ec1fcfb6abcbafb623d655d 100644
--- a/src/preparser.h
+++ b/src/preparser.h
@@ -979,7 +979,8 @@ class PreParserScope {
bool IsDeclared(const PreParserIdentifier& identifier) const { return false; }
void DeclareParameter(const PreParserIdentifier& identifier, VariableMode) {}
void RecordArgumentsUsage() {}
- void RecordSuperUsage() {}
+ void RecordSuperPropertyUsage() {}
+ void RecordSuperConstructorCallUsage() {}
void RecordThisUsage() {}
// Allow scope->Foo() to work.
@@ -2563,7 +2564,6 @@ ParserBase<Traits>::ParseMemberWithNewPrefixesExpression(bool* ok) {
int new_pos = position();
ExpressionT result = this->EmptyExpression();
if (Check(Token::SUPER)) {
- scope_->RecordSuperUsage();
result = this->SuperReference(scope_, factory());
} else {
result = this->ParseMemberWithNewPrefixesExpression(CHECK_OK);
@@ -2623,10 +2623,12 @@ ParserBase<Traits>::ParseMemberExpression(bool* ok) {
} else if (peek() == Token::SUPER) {
int beg_pos = position();
Consume(Token::SUPER);
- scope_->RecordSuperUsage();
Token::Value next = peek();
- if (next == Token::PERIOD || next == Token::LBRACK ||
- next == Token::LPAREN) {
+ if (next == Token::PERIOD || next == Token::LBRACK) {
+ scope_->RecordSuperPropertyUsage();
+ result = this->SuperReference(scope_, factory());
+ } else if (next == Token::LPAREN) {
+ scope_->RecordSuperConstructorCallUsage();
result = this->SuperReference(scope_, factory());
} else {
ReportMessageAt(Scanner::Location(beg_pos, position()),

Powered by Google App Engine
This is Rietveld 408576698