Commit 44382e94 authored by Toon Verwaest's avatar Toon Verwaest Committed by Commit Bot

[parser] Clear is_parenthesized on ThisExpression when accessing it

Otherwise (this) will leak into a later this=> making it seem like a valid
arrow function head.

Bug: chromium:941703
Change-Id: I5c3ff70f1d525ec0da53b401a0bfec4c1ee7812f
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1601260
Commit-Queue: Toon Verwaest <verwaest@chromium.org>
Reviewed-by: 's avatarLeszek Swirski <leszeks@chromium.org>
Cr-Commit-Position: refs/heads/master@{#61345}
parent 84435faf
......@@ -2938,6 +2938,13 @@ class AstNodeFactory final {
}
class ThisExpression* ThisExpression() {
// Clear any previously set "parenthesized" flag on this_expression_ so this
// particular token does not inherit the it. The flag is used to check
// during arrow function head parsing whether we came from parenthesized
// exprssion parsing, since additional arrow function verification was done
// there. It does not matter whether a flag is unset after arrow head
// verification, so clearing at this point is fine.
this_expression_->clear_parenthesized();
return this_expression_;
}
......
// 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("(this) , this =>", 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