Index: src/compiler/ast-graph-builder.cc |
diff --git a/src/compiler/ast-graph-builder.cc b/src/compiler/ast-graph-builder.cc |
index b24db9f40d8c954bfaa610f3e5d0d8ff6b3dbd26..6ce9269927c645fd16b8f6b431606bcd8101f570 100644 |
--- a/src/compiler/ast-graph-builder.cc |
+++ b/src/compiler/ast-graph-builder.cc |
@@ -1527,15 +1527,20 @@ |
void AstGraphBuilder::VisitClassLiteral(ClassLiteral* expr) { |
- // Visit declarations and class literal in a block scope. |
- if (expr->scope()->ContextLocalCount() > 0) { |
- Node* context = BuildLocalBlockContext(expr->scope()); |
- ContextScope scope(this, expr->scope(), context); |
- VisitDeclarations(expr->scope()->declarations()); |
+ if (expr->scope() == NULL) { |
+ // Visit class literal in the same scope, no declarations. |
VisitClassLiteralContents(expr); |
} else { |
- VisitDeclarations(expr->scope()->declarations()); |
- VisitClassLiteralContents(expr); |
+ // Visit declarations and class literal in a block scope. |
+ 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); |
+ } |
} |
} |
@@ -1633,7 +1638,8 @@ |
literal = NewNode(op, literal, proto); |
// Assign to class variable. |
- if (expr->class_variable_proxy() != nullptr) { |
+ if (expr->scope() != NULL) { |
+ DCHECK_NOT_NULL(expr->class_variable_proxy()); |
Variable* var = expr->class_variable_proxy()->var(); |
FrameStateBeforeAndAfter states(this, BailoutId::None()); |
VectorSlotPair feedback = CreateVectorSlotPair( |