Debian Codegraph @

tests/auto/qml/ecmascripttests/test262/test/language/expressions/class/dstr-meth-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-expr-meth-dflt.template
4 /*---
5 description: Rest object doesn't contain non-enumerable properties (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 o = {a: 3, b: 4};
63 Object.defineProperty(o, "x", { value: 4, enumerable: false });
64
65 var callCount = 0;
66 var C = class {
67 method({...rest} = o) {
68 assert.sameValue(rest.x, undefined);
69
70 verifyProperty(rest, "a", {
71 enumerable: true,
72 writable: true,
73 configurable: true,
74 value: 3
75 });
76
77 verifyProperty(rest, "b", {
78 enumerable: true,
79 writable: true,
80 configurable: true,
81 value: 4
82 });
83 callCount = callCount + 1;
84 }
85 };
86
87 new C().method();
88 assert.sameValue(callCount, 1, 'method invoked exactly once');