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

Unified Diff: src/ast-expression-visitor.cc

Issue 1414283002: [es6] Fix scoping for default parameters in arrow functions (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Rebased Created 5 years, 2 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/ast-expression-visitor.h ('k') | src/parameter-initializer-rewriter.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/ast-expression-visitor.cc
diff --git a/src/ast-expression-visitor.cc b/src/ast-expression-visitor.cc
index bbe8e9b67639fdf46672b61eb5edc73276f55704..7656420614826359fe0722dd959f073348e62ef7 100644
--- a/src/ast-expression-visitor.cc
+++ b/src/ast-expression-visitor.cc
@@ -32,14 +32,20 @@ namespace internal {
} while (false)
-AstExpressionVisitor::AstExpressionVisitor(Isolate* isolate,
- FunctionLiteral* root)
+AstExpressionVisitor::AstExpressionVisitor(Isolate* isolate, Expression* root)
: root_(root), depth_(0) {
InitializeAstVisitor(isolate);
}
-void AstExpressionVisitor::Run() { RECURSE(VisitFunctionLiteral(root_)); }
+AstExpressionVisitor::AstExpressionVisitor(uintptr_t stack_limit,
+ Expression* root)
+ : root_(root), depth_(0) {
+ InitializeAstVisitor(stack_limit);
+}
+
+
+void AstExpressionVisitor::Run() { RECURSE(Visit(root_)); }
void AstExpressionVisitor::VisitVariableDeclaration(VariableDeclaration* decl) {
@@ -229,6 +235,9 @@ void AstExpressionVisitor::VisitObjectLiteral(ObjectLiteral* expr) {
ZoneList<ObjectLiteralProperty*>* props = expr->properties();
for (int i = 0; i < props->length(); ++i) {
ObjectLiteralProperty* prop = props->at(i);
+ if (!prop->key()->IsLiteral()) {
+ RECURSE_EXPRESSION(Visit(prop->key()));
+ }
RECURSE_EXPRESSION(Visit(prop->value()));
}
}
@@ -342,10 +351,27 @@ void AstExpressionVisitor::VisitDeclarations(ZoneList<Declaration*>* decls) {
}
-void AstExpressionVisitor::VisitClassLiteral(ClassLiteral* expr) {}
+void AstExpressionVisitor::VisitClassLiteral(ClassLiteral* expr) {
+ VisitExpression(expr);
+ if (expr->extends() != nullptr) {
+ RECURSE_EXPRESSION(Visit(expr->extends()));
+ }
+ RECURSE_EXPRESSION(Visit(expr->constructor()));
+ ZoneList<ObjectLiteralProperty*>* props = expr->properties();
+ for (int i = 0; i < props->length(); ++i) {
+ ObjectLiteralProperty* prop = props->at(i);
+ if (!prop->key()->IsLiteral()) {
+ RECURSE_EXPRESSION(Visit(prop->key()));
+ }
+ RECURSE_EXPRESSION(Visit(prop->value()));
+ }
+}
-void AstExpressionVisitor::VisitSpread(Spread* expr) {}
+void AstExpressionVisitor::VisitSpread(Spread* expr) {
+ VisitExpression(expr);
+ RECURSE_EXPRESSION(Visit(expr->expression()));
+}
void AstExpressionVisitor::VisitEmptyParentheses(EmptyParentheses* expr) {}
« no previous file with comments | « src/ast-expression-visitor.h ('k') | src/parameter-initializer-rewriter.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698