Chromium Code Reviews| Index: src/parser.cc |
| diff --git a/src/parser.cc b/src/parser.cc |
| index 1345a790eb6258d0d0d6d6bdc5bfb95778ac42e8..9b39092f7ac977afc231e3d561c51255f0b307ea 100644 |
| --- a/src/parser.cc |
| +++ b/src/parser.cc |
| @@ -4100,7 +4100,11 @@ ClassLiteral* Parser::ParseClassLiteral(const AstRawString* name, |
| return NULL; |
| } |
| + // Create a block scope which is additionally tagged as class scope; this is |
| + // important for resolving variable references to the class name in the strong |
| + // mode. |
| Scope* block_scope = NewScope(scope_, BLOCK_SCOPE); |
| + block_scope->tag_as_class_scope(); |
| BlockState block_state(&scope_, block_scope); |
| scope_->SetLanguageMode( |
| static_cast<LanguageMode>(scope_->language_mode() | STRICT_BIT)); |
| @@ -4164,12 +4168,14 @@ ClassLiteral* Parser::ParseClassLiteral(const AstRawString* name, |
| } |
| block_scope->set_end_position(end_pos); |
| - block_scope = block_scope->FinalizeBlockScope(); |
| if (name != NULL) { |
| DCHECK_NOT_NULL(proxy); |
| - DCHECK_NOT_NULL(block_scope); |
| proxy->var()->set_initializer_position(end_pos); |
| + } else { |
| + // Unnamed classes should not have scopes (the scope will be empty). |
| + DCHECK(block_scope->num_var_or_const() == 0); |
|
arv (Not doing code reviews)
2015/03/09 13:39:05
Prefer DCHECK_EQ etc in general
marja
2015/03/09 13:44:06
Done.
|
| + block_scope = nullptr; |
| } |
| return factory()->NewClassLiteral(name, block_scope, proxy, extends, |