Commit 29f1475a authored by littledan's avatar littledan Committed by Commit bot

Refine duplicate arrow function parameter location handling

This patch fixes the logic of finding the location of a duplicate
parameter error in arrow functions by only looking at the error if it
exists. This should address a TSAN error. Further, an UNREACHABLE()
statement is inserted somewhere in the ExpressionClassifier code
to make future similar bugs easier to find.

BUG=v8:4483

Review-Url: https://codereview.chromium.org/2365693004
Cr-Commit-Position: refs/heads/master@{#39701}
parent 61689598
......@@ -410,6 +410,9 @@ class ExpressionClassifier {
// We should only be looking for an error when we know that one has
// been reported. But we're not... So this is to make sure we have
// the same behaviour.
UNREACHABLE();
// Make MSVC happy by returning an error from this inaccessible path.
static Error none;
return none;
}
......
......@@ -2609,7 +2609,9 @@ void Parser::ParseArrowFunctionFormalParameterList(
for (int i = 0; i < parameters->Arity(); ++i) {
auto parameter = parameters->at(i);
DeclareFormalParameter(parameters->scope, parameter);
if (!duplicate_loc->IsValid()) {
if (!this->classifier()
->is_valid_formal_parameter_list_without_duplicates() &&
!duplicate_loc->IsValid()) {
*duplicate_loc =
this->classifier()->duplicate_formal_parameter_error().location;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment