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 |