mirror of
https://github.com/tc39/test262.git
synced 2025-05-09 01:10:30 +02:00
* Adding case where PrivateName is used inside computed property. * Adding proper description to early errors on usage of undeclared private names inside computed property.
53 lines
1.6 KiB
JavaScript
53 lines
1.6 KiB
JavaScript
// This file was procedurally generated from the following sources:
|
|
// - src/class-elements/grammar-privatename-in-computed-property-missing.case
|
|
// - src/class-elements/syntax/invalid/cls-decl-elements-invalid-syntax.template
|
|
/*---
|
|
description: Use of undeclared PrivateName in ComputedProperty is a syntax error (class declaration)
|
|
esid: prod-ClassElement
|
|
features: [class-fields-private, class-fields-public, class]
|
|
flags: [generated]
|
|
negative:
|
|
phase: parse
|
|
type: SyntaxError
|
|
info: |
|
|
ClassElementName:
|
|
PropertyName
|
|
PrivateIdentifier
|
|
|
|
PropertyName:
|
|
LiteralPropertyName
|
|
ComputedPropertyName
|
|
|
|
ComputedPropertyName:
|
|
[ AssignmentExpression ]
|
|
|
|
AssignmentExpression ... MemberExpression
|
|
|
|
MemberExpression:
|
|
MemberExpression . PrivateName
|
|
|
|
Static Semantics: AllPrivateIdentifiersValid
|
|
AllPrivateIdentifiersValid is an abstract operation which takes names as an argument.
|
|
|
|
MemberExpression : MemberExpression . PrivateIdentifier
|
|
1. If StringValue of PrivateIdentifier is in names, return true.
|
|
2. Return false.
|
|
|
|
ClassBody : ClassElementList
|
|
1. Let newNames be the concatenation of names with PrivateBoundIdentifiers of ClassBody.
|
|
2. Return AllPrivateIdentifiersValid of ClassElementList with the argument newNames.
|
|
|
|
Static Semantics: Early Errors
|
|
|
|
ScriptBody : StatementList
|
|
It is a Syntax Error if AllPrivateIdentifiersValid of StatementList with an empty List as an argument is false unless the source code is eval code that is being processed by a direct eval.
|
|
|
|
---*/
|
|
|
|
|
|
$DONOTEVALUATE();
|
|
|
|
class C {
|
|
[this.#f] = 'Test262'
|
|
}
|