Index: src/preparser.h |
diff --git a/src/preparser.h b/src/preparser.h |
index 50dbcf1a46310b5bbed950705c2438dec70caae8..85844a08750eac415e72a9747402dc9b6df3e98c 100644 |
--- a/src/preparser.h |
+++ b/src/preparser.h |
@@ -2770,7 +2770,7 @@ typename ParserBase<Traits>::ExpressionT ParserBase<Traits>::ParseObjectLiteral( |
Expect(Token::LBRACE, CHECK_OK); |
while (peek() != Token::RBRACE) { |
- if (fni_ != nullptr) fni_->Enter(); |
+ FuncNameInferrer::State fni_state(fni_); |
const bool in_class = false; |
const bool is_static = false; |
@@ -2801,10 +2801,7 @@ typename ParserBase<Traits>::ExpressionT ParserBase<Traits>::ParseObjectLiteral( |
Expect(Token::COMMA, CHECK_OK); |
} |
- if (fni_ != nullptr) { |
- fni_->Infer(); |
- fni_->Leave(); |
- } |
+ if (fni_ != nullptr) fni_->Infer(); |
} |
Expect(Token::RBRACE, CHECK_OK); |
@@ -2906,7 +2903,7 @@ ParserBase<Traits>::ParseAssignmentExpression(bool accept_IN, |
return this->ParseYieldExpression(classifier, ok); |
} |
- if (fni_ != NULL) fni_->Enter(); |
+ FuncNameInferrer::State fni_state(fni_); |
ParserBase<Traits>::Checkpoint checkpoint(this); |
ExpressionClassifier arrow_formals_classifier(classifier->duplicate_finder()); |
bool parenthesized_formals = peek() == Token::LPAREN; |
@@ -2941,6 +2938,9 @@ ParserBase<Traits>::ParseAssignmentExpression(bool accept_IN, |
} |
expression = this->ParseArrowFunctionLiteral( |
parameters, arrow_formals_classifier, CHECK_OK); |
+ |
+ if (fni_ != nullptr) fni_->Infer(); |
+ |
return expression; |
} |
@@ -2951,7 +2951,6 @@ ParserBase<Traits>::ParseAssignmentExpression(bool accept_IN, |
ExpressionClassifier::FormalParametersProductions); |
if (!Token::IsAssignmentOp(peek())) { |
- if (fni_ != NULL) fni_->Leave(); |
// Parsed conditional expression only (no assignment). |
return expression; |
} |
@@ -3002,7 +3001,6 @@ ParserBase<Traits>::ParseAssignmentExpression(bool accept_IN, |
} else { |
fni_->RemoveLastFunction(); |
} |
- fni_->Leave(); |
} |
return factory()->NewAssignment(op, expression, right, pos); |
@@ -3469,7 +3467,7 @@ ParserBase<Traits>::ParseStrongInitializationExpression( |
// 'this' '.' IdentifierName '=' AssignmentExpression |
// 'this' '[' Expression ']' '=' AssignmentExpression |
- if (fni_ != NULL) fni_->Enter(); |
+ FuncNameInferrer::State fni_state(fni_); |
Consume(Token::THIS); |
int pos = position(); |
@@ -3528,7 +3526,6 @@ ParserBase<Traits>::ParseStrongInitializationExpression( |
} else { |
fni_->RemoveLastFunction(); |
} |
- fni_->Leave(); |
} |
if (function_state_->return_location().IsValid()) { |