[optional-chaining] Check optionality last when checking for direct eval

Bug: chromium:1112221
Change-Id: I402df2071eed82f44669910cf8e234f727e09581
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2335549
Reviewed-by: Leszek Swirski <leszeks@chromium.org>
Commit-Queue: Shu-yu Guo <syg@chromium.org>
Cr-Commit-Position: refs/heads/master@{#69230}
This commit is contained in:
Shu-yu Guo 2020-08-03 11:34:11 -07:00 committed by Commit Bot
parent 1a033ae82f
commit 4779459493

View File

@ -1405,8 +1405,8 @@ class ParserBase {
Call::PossiblyEval CheckPossibleEvalCall(ExpressionT expression,
bool is_optional_call,
Scope* scope) {
if (!is_optional_call && impl()->IsIdentifier(expression) &&
impl()->IsEval(impl()->AsIdentifier(expression))) {
if (impl()->IsIdentifier(expression) &&
impl()->IsEval(impl()->AsIdentifier(expression)) && !is_optional_call) {
function_state_->RecordFunctionOrEvalCall();
scope->RecordEvalCall();