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

Unified Diff: src/ast-this-access-visitor.cc

Issue 770843002: harmony-classes: Fix some issues with syntactic restriction on super(...). (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 6 years 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
« no previous file with comments | « src/ast-this-access-visitor.h ('k') | src/scopes.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/ast-this-access-visitor.cc
diff --git a/src/ast-this-access-visitor.cc b/src/ast-this-access-visitor.cc
index e66f961f817197d85e2b02f30cefcec00effc9d4..cf4a3de842a999a764a57aa1ecf437222a738e50 100644
--- a/src/ast-this-access-visitor.cc
+++ b/src/ast-this-access-visitor.cc
@@ -22,6 +22,21 @@ void ATAV::VisitVariableProxy(VariableProxy* proxy) {
}
+void ATAV::VisitSuperReference(SuperReference* leaf) {
+ // disallow super.method() and super(...).
+ uses_this_ = true;
+}
+
+
+void ATAV::VisitCallNew(CallNew* e) {
+ // new super(..) does not use 'this'.
+ if (!e->expression()->IsSuperReference()) {
+ Visit(e->expression());
+ }
+ VisitExpressions(e->arguments());
+}
+
+
// ---------------------------------------------------------------------------
// -- Leaf nodes -------------------------------------------------------------
// ---------------------------------------------------------------------------
@@ -43,8 +58,6 @@ void ATAV::VisitNativeFunctionLiteral(NativeFunctionLiteral* leaf) {}
void ATAV::VisitLiteral(Literal* leaf) {}
void ATAV::VisitRegExpLiteral(RegExpLiteral* leaf) {}
void ATAV::VisitThisFunction(ThisFunction* leaf) {}
-void ATAV::VisitSuperReference(SuperReference* leaf) {}
-
// ---------------------------------------------------------------------------
// -- Pass-through nodes------------------------------------------------------
@@ -95,7 +108,7 @@ void ATAV::VisitTryFinallyStatement(TryFinallyStatement* stmt) {
void ATAV::VisitClassLiteral(ClassLiteral* e) {
VisitIfNotNull(e->extends());
- VisitIfNotNull(e->constructor());
+ Visit(e->constructor());
ZoneList<ObjectLiteralProperty*>* properties = e->properties();
for (int i = 0; i < properties->length(); i++) {
Visit(properties->at(i)->value());
@@ -142,12 +155,6 @@ void ATAV::VisitCall(Call* e) {
}
-void ATAV::VisitCallNew(CallNew* e) {
- Visit(e->expression());
- VisitExpressions(e->arguments());
-}
-
-
void ATAV::VisitCallRuntime(CallRuntime* e) {
VisitExpressions(e->arguments());
}
« no previous file with comments | « src/ast-this-access-visitor.h ('k') | src/scopes.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698