Debian Codegraph @

tests/auto/qml/ecmascripttests/test262/test/language/expressions/object/dstr-meth-dflt-obj-ptrn-rest-val-obj.js

raw
1 // This file was procedurally generated from the following sources:
2 // - src/dstr-binding/obj-ptrn-rest-val-obj.case
3 // - src/dstr-binding/default/meth-dflt.template
4 /*---
5 description: Rest object contains just unextracted data (method (default parameter))
6 esid: sec-runtime-semantics-definemethod
7 es6id: 14.3.8
8 features: [object-rest, destructuring-binding, default-parameters]
9 flags: [generated]
10 includes: [propertyHelper.js]
11 info: |
12 MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
13
14 [...]
15 6. Let closure be FunctionCreate(kind, StrictFormalParameters,
16 FunctionBody, scope, strict). If functionPrototype was passed as a
17 parameter then pass its value as the functionPrototype optional argument
18 of FunctionCreate.
19 [...]
20
21 9.2.1 [[Call]] ( thisArgument, argumentsList)
22
23 [...]
24 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
25 [...]
26
27 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
28
29 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
30 [...]
31
32 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
33
34 [...]
35 23. Let iteratorRecord be Record {[[iterator]]:
36 CreateListIterator(argumentsList), [[done]]: false}.
37 24. If hasDuplicates is true, then
38 [...]
39 25. Else,
40 b. Let formalStatus be IteratorBindingInitialization for formals with
41 iteratorRecord and env as arguments.
42 [...]
43 ---*/
44
45 var callCount = 0;
46 var obj = {
47 method({a, b, ...rest} = {x: 1, y: 2, a: 5, b: 3}) {
48 assert.sameValue(rest.a, undefined);
49 assert.sameValue(rest.b, undefined);
50
51 verifyProperty(rest, "x", {
52 enumerable: true,
53 writable: true,
54 configurable: true,
55 value: 1
56 });
57
58 verifyProperty(rest, "y", {
59 enumerable: true,
60 writable: true,
61 configurable: true,
62 value: 2
63 });
64 callCount = callCount + 1;
65 }
66 };
67
68 obj.method();
69 assert.sameValue(callCount, 1, 'method invoked exactly once');