| Index: src/compiler/ast-graph-builder.cc
|
| diff --git a/src/compiler/ast-graph-builder.cc b/src/compiler/ast-graph-builder.cc
|
| index cde5e7182df0cba24ed1147a4b503d62a9b0a9e9..1ccd48ee6a5fb280b2e6884dffca51440dc7f637 100644
|
| --- a/src/compiler/ast-graph-builder.cc
|
| +++ b/src/compiler/ast-graph-builder.cc
|
| @@ -462,9 +462,12 @@ void AstGraphBuilder::VisitBlock(Block* stmt) {
|
| // Visit statements in the same scope, no declarations.
|
| VisitStatements(stmt->statements());
|
| } else {
|
| - const Operator* op = javascript()->CreateBlockContext();
|
| - Node* scope_info = jsgraph()->Constant(stmt->scope()->GetScopeInfo());
|
| - Node* context = NewNode(op, scope_info, GetFunctionClosure());
|
| + Node* context = nullptr;
|
| + if (stmt->scope()->ContextLocalCount() > 0) {
|
| + const Operator* op = javascript()->CreateBlockContext();
|
| + Node* scope_info = jsgraph()->Constant(stmt->scope()->GetScopeInfo());
|
| + context = NewNode(op, scope_info, GetFunctionClosure());
|
| + }
|
| ContextScope scope(this, stmt->scope(), context);
|
|
|
| // Visit declarations and statements in a block scope.
|
|
|