Debian Codegraph @

js/src/tests/test262/language/statements/class/dstr/private-meth-static-dflt-obj-ptrn-rest-skip-non-enumerable.js

raw
1 // This file was procedurally generated from the following sources:
2 // - src/dstr-binding/obj-ptrn-rest-skip-non-enumerable.case
3 // - src/dstr-binding/default/cls-decl-private-meth-static-dflt.template
4 /*---
5 description: Rest object doesn't contain non-enumerable properties (private static class expression method (default parameter))
6 esid: sec-runtime-semantics-bindingclassdeclarationevaluation
7 features: [object-rest, class, class-static-methods-private, destructuring-binding, default-parameters]
8 flags: [generated]
9 includes: [propertyHelper.js]
10 info: |
11 ClassDeclaration : class BindingIdentifier ClassTail
12
13 1. Let className be StringValue of BindingIdentifier.
14 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
15 argument className.
16 [...]
17
18 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
19
20 21. For each ClassElement m in order from methods
21 a. If IsStatic of m is false, then
22 b. Else,
23 Let status be the result of performing PropertyDefinitionEvaluation for
24 m with arguments F and false.
25 [...]
26
27 14.3.8 Runtime Semantics: DefineMethod
28
29 MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
30
31 [...]
32 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
33 scope, strict). If functionPrototype was passed as a parameter then pass its
34 value as the functionPrototype optional argument of FunctionCreate.
35 [...]
36
37 9.2.1 [[Call]] ( thisArgument, argumentsList)
38
39 [...]
40 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
41 [...]
42
43 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
44
45 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
46 [...]
47
48 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
49
50 [...]
51 23. Let iteratorRecord be Record {[[iterator]]:
52 CreateListIterator(argumentsList), [[done]]: false}.
53 24. If hasDuplicates is true, then
54 [...]
55 25. Else,
56 b. Let formalStatus be IteratorBindingInitialization for formals with
57 iteratorRecord and env as arguments.
58 [...]
59 ---*/
60 var o = {a: 3, b: 4};
61 Object.defineProperty(o, "x", { value: 4, enumerable: false });
62
63 var callCount = 0;
64 class C {
65 static #method({...rest} = o) {
66 assert.sameValue(rest.x, undefined);
67
68 verifyProperty(rest, "a", {
69 enumerable: true,
70 writable: true,
71 configurable: true,
72 value: 3
73 });
74
75 verifyProperty(rest, "b", {
76 enumerable: true,
77 writable: true,
78 configurable: true,
79 value: 4
80 });
81 callCount = callCount + 1;
82 }
83
84 static get method() {
85 return this.#method;
86 }
87 };
88
89 C.method();
90 assert.sameValue(callCount, 1, 'method invoked exactly once');
91
92 reportCompare(0, 0);