[parser] Refactor ParseSuperExpression
Throw error when accessing private field on super. Bug: v8:8872 Change-Id: Iad383890fafbdccdd6b6b75a8f9eb32c9d6f5044 Reviewed-on: https://chromium-review.googlesource.com/c/1478219 Reviewed-by: Toon Verwaest <verwaest@chromium.org> Commit-Queue: Sathya Gunasekaran <gsathya@chromium.org> Cr-Commit-Position: refs/heads/master@{#59746}
This commit is contained in:
parent
bab6615155
commit
72ce4de2c8
@ -478,6 +478,7 @@ namespace internal {
|
||||
T(TypedArrayTooShort, \
|
||||
"Derived TypedArray constructor created an array which was too small") \
|
||||
T(UnexpectedEOS, "Unexpected end of input") \
|
||||
T(UnexpectedPrivateField, "Unexpected private field") \
|
||||
T(UnexpectedReserved, "Unexpected reserved word") \
|
||||
T(UnexpectedStrictReserved, "Unexpected strict mode reserved word") \
|
||||
T(UnexpectedSuper, "'super' keyword unexpected here") \
|
||||
|
@ -3318,6 +3318,13 @@ typename ParserBase<Impl>::ExpressionT ParserBase<Impl>::ParseSuperExpression(
|
||||
if (IsConciseMethod(kind) || IsAccessorFunction(kind) ||
|
||||
IsClassConstructor(kind)) {
|
||||
if (Token::IsProperty(peek())) {
|
||||
if (peek() == Token::PERIOD && PeekAhead() == Token::PRIVATE_NAME) {
|
||||
Consume(Token::PERIOD);
|
||||
Consume(Token::PRIVATE_NAME);
|
||||
|
||||
impl()->ReportMessage(MessageTemplate::kUnexpectedPrivateField);
|
||||
return impl()->FailureExpression();
|
||||
}
|
||||
scope->RecordSuperPropertyUsage();
|
||||
UseThis();
|
||||
return impl()->NewSuperPropertyReference(pos);
|
||||
|
@ -588,10 +588,6 @@
|
||||
'language/comments/hashbang/preceding-whitespace': [FAIL],
|
||||
'language/comments/hashbang/use-strict': [FAIL],
|
||||
|
||||
# https://bugs.chromium.org/p/v8/issues/detail?id=8872
|
||||
'language/statements/class/elements/syntax/early-errors/grammar-private-field-super-access': [SKIP],
|
||||
'language/expressions/class/elements/syntax/early-errors/grammar-private-field-super-access': [SKIP],
|
||||
|
||||
######################## NEEDS INVESTIGATION ###########################
|
||||
|
||||
# https://bugs.chromium.org/p/v8/issues/detail?id=7833
|
||||
|
Loading…
Reference in New Issue
Block a user