| Index: src/compiler/ast-graph-builder.cc
|
| diff --git a/src/compiler/ast-graph-builder.cc b/src/compiler/ast-graph-builder.cc
|
| index 6828b5b0a86c7bb3e85ae2745c12401a1f5cc812..b0fde277df61353b8e6e6b702384c8ce3413d8e2 100644
|
| --- a/src/compiler/ast-graph-builder.cc
|
| +++ b/src/compiler/ast-graph-builder.cc
|
| @@ -1005,10 +1005,15 @@ void AstGraphBuilder::VisitBlock(Block* stmt) {
|
| VisitStatements(stmt->statements());
|
| } else {
|
| // Visit declarations and statements in a block scope.
|
| - Node* context = BuildLocalBlockContext(stmt->scope());
|
| - ContextScope scope(this, stmt->scope(), context);
|
| - VisitDeclarations(stmt->scope()->declarations());
|
| - VisitStatements(stmt->statements());
|
| + if (stmt->scope()->ContextLocalCount() > 0) {
|
| + Node* context = BuildLocalBlockContext(stmt->scope());
|
| + ContextScope scope(this, stmt->scope(), context);
|
| + VisitDeclarations(stmt->scope()->declarations());
|
| + VisitStatements(stmt->statements());
|
| + } else {
|
| + VisitDeclarations(stmt->scope()->declarations());
|
| + VisitStatements(stmt->statements());
|
| + }
|
| }
|
| if (stmt->labels() != NULL) block.EndBlock();
|
| }
|
| @@ -1463,10 +1468,15 @@ void AstGraphBuilder::VisitClassLiteral(ClassLiteral* expr) {
|
| VisitClassLiteralContents(expr);
|
| } else {
|
| // Visit declarations and class literal in a block scope.
|
| - Node* context = BuildLocalBlockContext(expr->scope());
|
| - ContextScope scope(this, expr->scope(), context);
|
| - VisitDeclarations(expr->scope()->declarations());
|
| - VisitClassLiteralContents(expr);
|
| + if (expr->scope()->ContextLocalCount() > 0) {
|
| + Node* context = BuildLocalBlockContext(expr->scope());
|
| + ContextScope scope(this, expr->scope(), context);
|
| + VisitDeclarations(expr->scope()->declarations());
|
| + VisitClassLiteralContents(expr);
|
| + } else {
|
| + VisitDeclarations(expr->scope()->declarations());
|
| + VisitClassLiteralContents(expr);
|
| + }
|
| }
|
| }
|
|
|
|
|