Commit 6d97ac5b authored by Toon Verwaest's avatar Toon Verwaest Committed by Commit Bot

[parser] Add early return for declaration error in arrow head

Otherwise the expression scope may be in a weird state and DCHECKs for valid
arrow functions in ValidateAndCreateScope willl unnecessarily fire.

Bug: chromium:1018611
Change-Id: I101b8902dce07c29aacba3e7a5e6f86d66505d5b
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1879906Reviewed-by: 's avatarDan Elphick <delphick@chromium.org>
Commit-Queue: Toon Verwaest <verwaest@chromium.org>
Cr-Commit-Position: refs/heads/master@{#64591}
parent 376f1b69
......@@ -747,13 +747,14 @@ class ArrowHeadParsingScope : public ExpressionParsingScope<Types> {
DeclarationScope* ValidateAndCreateScope() {
DCHECK(!this->is_verified());
DeclarationScope* result = this->parser()->NewFunctionScope(kind());
if (declaration_error_location.IsValid()) {
ExpressionScope<Types>::Report(declaration_error_location,
declaration_error_message);
return result;
}
this->ValidatePattern();
DeclarationScope* result = this->parser()->NewFunctionScope(kind());
if (!has_simple_parameter_list_) result->SetHasNonSimpleParameters();
VariableKind kind = PARAMETER_VARIABLE;
VariableMode mode =
......
// Copyright 2019 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
assertThrows("(l-(c))=>", SyntaxError);
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