Debian Codegraph @

js/src/tests/test262/language/statements/function/dstr/dflt-ary-ptrn-rest-init-obj.js

raw
1 // |reftest| error:SyntaxError
2 // This file was procedurally generated from the following sources:
3 // - src/dstr-binding/ary-ptrn-rest-init-obj.case
4 // - src/dstr-binding/default/func-decl-dflt.template
5 /*---
6 description: Rest element (nested object pattern) does not support initializer (function declaration (default parameter))
7 esid: sec-function-definitions-runtime-semantics-instantiatefunctionobject
8 features: [destructuring-binding, default-parameters]
9 flags: [generated]
10 negative:
11 phase: parse
12 type: SyntaxError
13 info: |
14 FunctionDeclaration :
15 function BindingIdentifier ( FormalParameters ) { FunctionBody }
16
17 [...]
18 3. Let F be FunctionCreate(Normal, FormalParameters, FunctionBody,
19 scope, strict).
20 [...]
21
22 9.2.1 [[Call]] ( thisArgument, argumentsList)
23
24 [...]
25 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
26 [...]
27
28 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
29
30 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
31 [...]
32
33 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
34
35 [...]
36 23. Let iteratorRecord be Record {[[iterator]]:
37 CreateListIterator(argumentsList), [[done]]: false}.
38 24. If hasDuplicates is true, then
39 [...]
40 25. Else,
41 b. Let formalStatus be IteratorBindingInitialization for formals with
42 iteratorRecord and env as arguments.
43 [...]
44
45 13.3.3 Destructuring Binding Patterns
46 ArrayBindingPattern[Yield] :
47 [ Elisionopt BindingRestElement[?Yield]opt ]
48 [ BindingElementList[?Yield] ]
49 [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ]
50 ---*/
51 $DONOTEVALUATE();
52
53 var callCount = 0;
54 function f([...{ x } = []] = []) {
55
56 callCount = callCount + 1;
57 };
58 f();
59 assert.sameValue(callCount, 1, 'function invoked exactly once');