| 1 |
// This file was procedurally generated from the following sources: |
| 2 |
// - src/class-elements/private-static-method-length.case |
| 3 |
// - src/class-elements/default/cls-expr.template |
| 4 |
/*--- |
| 5 |
description: Private static methods have length property properly configured (field definitions in a class expression) |
| 6 |
esid: prod-FieldDefinition |
| 7 |
features: [class-static-methods-private, class] |
| 8 |
flags: [generated] |
| 9 |
info: | |
| 10 |
Updated Productions |
| 11 |
|
| 12 |
ClassElement : MethodDefinition |
| 13 |
1. Return ClassElementEvaluation of MethodDefinition with arguments ! Get(homeObject, "prototype"),enumerable, and "prototype". |
| 14 |
|
| 15 |
ClassElement : static MethodDefinition |
| 16 |
1. Return ClassElementEvaluation of MethodDefinition with arguments homeObject, enumerable and "static". |
| 17 |
|
| 18 |
MethodDefinition : ClassElementName( UniqueFormalParameters ) { FunctionBody } |
| 19 |
1. Let methodDef be DefineMethod of MethodDefinition with argument homeObject. |
| 20 |
2. ReturnIfAbrupt(methodDef). |
| 21 |
3. Perform ? DefineOrdinaryMethod(methodDef.[[Key]], homeObject, methodDef.[[Closure]], _enumerable). |
| 22 |
|
| 23 |
ClassElement : MethodDefinition |
| 24 |
ClassElement : static MethodDefinition |
| 25 |
1. Perform ? PropertyDefinitionEvaluation with parameters object and enumerable. |
| 26 |
2. Return empty. |
| 27 |
|
| 28 |
MethodDefinition : ClassElementName (UniqueFormalParameters) { FunctionBody } |
| 29 |
... |
| 30 |
8. Let closure be FunctionCreate(kind, UniqueFormalParameters, FunctionBody, scope, privateScope, strict, prototype). |
| 31 |
9. Perform MakeMethod(closure, object). |
| 32 |
10. Return the Record{[[Key]]: propKey, [[Closure]]: closure}. |
| 33 |
|
| 34 |
---*/ |
| 35 |
|
| 36 |
|
| 37 |
var C = class { |
| 38 |
static #method(a, b, c) {}; |
| 39 |
|
| 40 |
static getPrivateMethod() { |
| 41 |
return this.#method; |
| 42 |
} |
| 43 |
|
| 44 |
} |
| 45 |
|
| 46 |
assert.sameValue(C.getPrivateMethod().length, 3); |
| 47 |
|
| 48 |
reportCompare(0, 0); |