Debian Codegraph @

tests/auto/qml/ecmascripttests/test262/test/language/expressions/class/dstr-gen-meth-static-dflt-obj-ptrn-rest-getter.js

raw
1 // This file was procedurally generated from the following sources:
2 // - src/dstr-binding/obj-ptrn-rest-getter.case
3 // - src/dstr-binding/default/cls-expr-gen-meth-static-dflt.template
4 /*---
5 description: Getter is called when obj is being deconstructed to a rest Object (static class expression generator method (default parameter))
6 esid: sec-class-definitions-runtime-semantics-evaluation
7 es6id: 14.5.16
8 features: [object-rest, generators, destructuring-binding, default-parameters]
9 flags: [generated]
10 includes: [propertyHelper.js]
11 info: |
12 ClassExpression : class BindingIdentifieropt ClassTail
13
14 1. If BindingIdentifieropt is not present, let className be undefined.
15 2. Else, let className be StringValue of BindingIdentifier.
16 3. Let value be the result of ClassDefinitionEvaluation of ClassTail
17 with argument className.
18 [...]
19
20 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
21
22 21. For each ClassElement m in order from methods
23 a. If IsStatic of m is false, then
24 b. Else,
25 Let status be the result of performing PropertyDefinitionEvaluation
26 for m with arguments F and false.
27 [...]
28
29 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
30
31 GeneratorMethod :
32 * PropertyName ( StrictFormalParameters ) { GeneratorBody }
33
34 1. Let propKey be the result of evaluating PropertyName.
35 2. ReturnIfAbrupt(propKey).
36 3. If the function code for this GeneratorMethod is strict mode code,
37 let strict be true. Otherwise let strict be false.
38 4. Let scope be the running execution context's LexicalEnvironment.
39 5. Let closure be GeneratorFunctionCreate(Method,
40 StrictFormalParameters, GeneratorBody, scope, strict).
41
42 9.2.1 [[Call]] ( thisArgument, argumentsList)
43
44 [...]
45 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
46 [...]
47
48 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
49
50 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
51 [...]
52
53 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
54
55 [...]
56 23. Let iteratorRecord be Record {[[iterator]]:
57 CreateListIterator(argumentsList), [[done]]: false}.
58 24. If hasDuplicates is true, then
59 [...]
60 25. Else,
61 b. Let formalStatus be IteratorBindingInitialization for formals with
62 iteratorRecord and env as arguments.
63 [...]
64 ---*/
65 var count = 0;
66
67 var callCount = 0;
68 var C = class {
69 static *method({...x} = { get v() { count++; return 2; } }) {
70 assert.sameValue(count, 1);
71
72 verifyProperty(x, "v", {
73 enumerable: true,
74 writable: true,
75 configurable: true,
76 value: 2
77 });
78 callCount = callCount + 1;
79 }
80 };
81
82 C.method().next();
83 assert.sameValue(callCount, 1, 'method invoked exactly once');