Debian Codegraph @

tests/auto/qml/ecmascripttests/test262/test/language/expressions/class/dstr-meth-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-meth-dflt.template
4 /*---
5 description: Getter is called when obj is being deconstructed to a rest Object (class expression method (default parameter))
6 esid: sec-class-definitions-runtime-semantics-evaluation
7 es6id: 14.5.16
8 features: [object-rest, 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 i. Let status be the result of performing
25 PropertyDefinitionEvaluation for m with arguments proto and
26 false.
27 [...]
28
29 14.3.8 Runtime Semantics: DefineMethod
30
31 MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
32
33 [...]
34 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
35 scope, strict). If functionPrototype was passed as a parameter then pass its
36 value as the functionPrototype optional argument of FunctionCreate.
37 [...]
38
39 9.2.1 [[Call]] ( thisArgument, argumentsList)
40
41 [...]
42 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
43 [...]
44
45 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
46
47 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
48 [...]
49
50 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
51
52 [...]
53 23. Let iteratorRecord be Record {[[iterator]]:
54 CreateListIterator(argumentsList), [[done]]: false}.
55 24. If hasDuplicates is true, then
56 [...]
57 25. Else,
58 b. Let formalStatus be IteratorBindingInitialization for formals with
59 iteratorRecord and env as arguments.
60 [...]
61 ---*/
62 var count = 0;
63
64 var callCount = 0;
65 var C = class {
66 method({...x} = { get v() { count++; return 2; } }) {
67 assert.sameValue(count, 1);
68
69 verifyProperty(x, "v", {
70 enumerable: true,
71 writable: true,
72 configurable: true,
73 value: 2
74 });
75 callCount = callCount + 1;
76 }
77 };
78
79 new C().method();
80 assert.sameValue(callCount, 1, 'method invoked exactly once');