Commit 667c0d36 authored by Shu-yu Guo's avatar Shu-yu Guo Committed by Commit Bot

Support the o?.#foo syntax

Bug: v8:10371, v8:10396
Change-Id: I55359ac5d96369962d472f8a7e5d01303b823be0
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2145240
Commit-Queue: Leszek Swirski <leszeks@chromium.org>
Reviewed-by: 's avatarLeszek Swirski <leszeks@chromium.org>
Auto-Submit: Shu-yu Guo <syg@chromium.org>
Cr-Commit-Position: refs/heads/master@{#67108}
parent bc12982d
......@@ -3397,13 +3397,7 @@ ParserBase<Impl>::ParseLeftHandSideContinuation(ExpressionT result) {
if (is_optional) {
DCHECK_EQ(scanner()->current_token(), Token::QUESTION_PERIOD);
int pos = position();
Token::Value next = Next();
if (V8_UNLIKELY(!Token::IsPropertyName(next))) {
ReportUnexpectedToken(next);
return impl()->FailureExpression();
}
IdentifierT name = impl()->GetSymbol();
ExpressionT key = factory()->NewStringLiteral(name, position());
ExpressionT key = ParsePropertyOrPrivatePropertyName();
result = factory()->NewProperty(result, key, pos, is_optional);
break;
}
......
......@@ -101,7 +101,6 @@ shouldThrowSyntaxError('function foo() { new?.target; }');
shouldThrowSyntaxError('function tag() {} tag?.``;');
shouldThrowSyntaxError('const o = { tag() {} }; o?.tag``;');
shouldThrowSyntaxError('class A { #foo = "hi"; constructor() { this?.#foo; } }')
const o2 = {
count: 0,
......
......@@ -702,10 +702,6 @@
'language/expressions/logical-assignment/lgcl-or-assignment-operator-unresolved-rhs-put': [FAIL],
'language/expressions/logical-assignment/lgcl-or-whitespace': [FAIL],
# https://bugs.chromium.org/p/v8/issues/detail?id=10396
'language/expressions/class/elements/grammar-private-field-optional-chaining': [FAIL],
'language/statements/class/elements/grammar-private-field-optional-chaining': [FAIL],
# https://bugs.chromium.org/p/v8/issues/detail?id=10397
'language/statements/for-await-of/iterator-close-throw-get-method-abrupt': [FAIL],
'language/statements/for-of/iterator-close-throw-get-method-abrupt': [FAIL],
......
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