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

Unified Diff: src/parsing/parameter-initializer-rewriter.cc

Issue 1887743002: Re-scope inner scopes in arrow parameter initializers (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Rebase and mark mjsunit/harmony/regress/regress-4658 as good for ignition Created 4 years, 8 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/ast-expression-visitor.h ('k') | test/mjsunit/harmony/regress/regress-4904.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/parsing/parameter-initializer-rewriter.cc
diff --git a/src/parsing/parameter-initializer-rewriter.cc b/src/parsing/parameter-initializer-rewriter.cc
index 3e3587b2bd75bcf6646bcd18635bf1a8f956d55c..ed553a7e0b83b59f6dc2ee51e5555bae8749aed0 100644
--- a/src/parsing/parameter-initializer-rewriter.cc
+++ b/src/parsing/parameter-initializer-rewriter.cc
@@ -29,6 +29,10 @@ class Rewriter final : public AstExpressionVisitor {
void VisitClassLiteral(ClassLiteral* expr) override;
void VisitVariableProxy(VariableProxy* expr) override;
+ void VisitBlock(Block* stmt) override;
+ void VisitTryCatchStatement(TryCatchStatement* stmt) override;
+ void VisitWithStatement(WithStatement* stmt) override;
+
Scope* old_scope_;
Scope* new_scope_;
};
@@ -73,6 +77,26 @@ void Rewriter::VisitVariableProxy(VariableProxy* proxy) {
}
+void Rewriter::VisitBlock(Block* stmt) {
+ if (stmt->scope() != nullptr)
+ stmt->scope()->ReplaceOuterScope(new_scope_);
+ else
+ VisitStatements(stmt->statements());
+}
+
+
+void Rewriter::VisitTryCatchStatement(TryCatchStatement* stmt) {
+ Visit(stmt->try_block());
+ stmt->scope()->ReplaceOuterScope(new_scope_);
+}
+
+
+void Rewriter::VisitWithStatement(WithStatement* stmt) {
+ Visit(stmt->expression());
+ stmt->scope()->ReplaceOuterScope(new_scope_);
+}
+
+
} // anonymous namespace
« no previous file with comments | « src/ast/ast-expression-visitor.h ('k') | test/mjsunit/harmony/regress/regress-4904.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698