Chromium Code Reviews| Index: src/parsing/parser.cc |
| diff --git a/src/parsing/parser.cc b/src/parsing/parser.cc |
| index ccb106598db55002acf5d4dd0d0534bda03465cb..d2919e1216e3a32ea3cfb90f5b726bba75854ddb 100644 |
| --- a/src/parsing/parser.cc |
| +++ b/src/parsing/parser.cc |
| @@ -2253,10 +2253,8 @@ Statement* Parser::ParseFunctionDeclaration( |
| const AstRawString* name = ParseIdentifierOrStrictReservedWord( |
| &is_strict_reserved, CHECK_OK); |
| - if (fni_ != NULL) { |
| - fni_->Enter(); |
| - fni_->PushEnclosingName(name); |
| - } |
| + FuncNameInferrer::State fni_state(fni_); |
| + if (fni_ != NULL) fni_->PushEnclosingName(name); |
| FunctionLiteral* fun = ParseFunctionLiteral( |
| name, scanner()->location(), |
| is_strict_reserved ? kFunctionNameIsStrictReserved |
| @@ -2265,7 +2263,6 @@ Statement* Parser::ParseFunctionDeclaration( |
| : FunctionKind::kNormalFunction, |
| pos, FunctionLiteral::DECLARATION, FunctionLiteral::NORMAL_ARITY, |
| language_mode(), CHECK_OK); |
| - if (fni_ != NULL) fni_->Leave(); |
| // Even if we're not at the top-level of the global or a function |
| // scope, we treat it as such and introduce the function with its |
| @@ -2495,7 +2492,7 @@ void Parser::ParseVariableDeclarations(VariableDeclarationContext var_context, |
| int bindings_start = peek_position(); |
| bool is_for_iteration_variable; |
| do { |
| - if (fni_ != NULL) fni_->Enter(); |
| + FuncNameInferrer::State fni_state(fni_); |
| // Parse name. |
| if (!first_declaration) Consume(Token::COMMA); |
| @@ -2585,7 +2582,6 @@ void Parser::ParseVariableDeclarations(VariableDeclarationContext var_context, |
| value = GetLiteralUndefined(position()); |
| } |
| - if (single_name && fni_ != NULL) fni_->Leave(); |
|
adamk
2015/12/10 01:56:53
Pretty sure this was a bug before.
Dan Ehrenberg
2015/12/10 18:22:41
Awesome!
|
| parsing_result->declarations.Add(DeclarationParsingResult::Declaration( |
| pattern, initializer_position, value)); |
| first_declaration = false; |
| @@ -4943,7 +4939,7 @@ ClassLiteral* Parser::ParseClassLiteral(const AstRawString* name, |
| const bool has_extends = extends != nullptr; |
| while (peek() != Token::RBRACE) { |
| if (Check(Token::SEMICOLON)) continue; |
| - if (fni_ != NULL) fni_->Enter(); |
| + FuncNameInferrer::State fni_state(fni_); |
| const bool in_class = true; |
| const bool is_static = false; |
| bool is_computed_name = false; // Classes do not care about computed |
| @@ -4961,10 +4957,7 @@ ClassLiteral* Parser::ParseClassLiteral(const AstRawString* name, |
| properties->Add(property, zone()); |
| } |
| - if (fni_ != NULL) { |
| - fni_->Infer(); |
| - fni_->Leave(); |
| - } |
| + if (fni_ != NULL) fni_->Infer(); |
| } |
| Expect(Token::RBRACE, CHECK_OK); |