Index: src/parser.cc |
diff --git a/src/parser.cc b/src/parser.cc |
index 2c33878b9c16c8f7676df5f9ac021b5681c6150c..3bc20bda6326402c1e1612158c6a15b8854f1c54 100644 |
--- a/src/parser.cc |
+++ b/src/parser.cc |
@@ -1929,11 +1929,15 @@ Variable* Parser::Declare(Declaration* declaration, bool resolve, bool* ok) { |
var = declaration_scope->LookupLocal(name); |
if (var == NULL) { |
// Declare the name. |
+ Variable::Kind kind = Variable::NORMAL; |
+ if (declaration->IsFunctionDeclaration()) { |
+ kind = Variable::FUNCTION; |
+ } else if (declaration->IsVariableDeclaration() && |
+ declaration->AsVariableDeclaration()->is_class_declaration()) { |
+ kind = Variable::CLASS; |
+ } |
var = declaration_scope->DeclareLocal( |
- name, mode, declaration->initialization(), |
- declaration->IsFunctionDeclaration() ? Variable::FUNCTION |
- : Variable::NORMAL, |
- kNotAssigned); |
+ name, mode, declaration->initialization(), kind, kNotAssigned); |
} else if (IsLexicalVariableMode(mode) || |
IsLexicalVariableMode(var->mode()) || |
((mode == CONST_LEGACY || var->mode() == CONST_LEGACY) && |
@@ -2151,8 +2155,9 @@ Statement* Parser::ParseClassDeclaration(ZoneList<const AstRawString*>* names, |
VariableMode mode = is_strong(language_mode()) ? CONST : LET; |
VariableProxy* proxy = NewUnresolved(name, mode); |
- Declaration* declaration = |
- factory()->NewVariableDeclaration(proxy, mode, scope_, pos); |
+ const bool is_class_declaration = true; |
+ Declaration* declaration = factory()->NewVariableDeclaration( |
+ proxy, mode, scope_, pos, is_class_declaration); |
Declare(declaration, true, CHECK_OK); |
proxy->var()->set_initializer_position(position()); |