Debian Codegraph @

js/src/tests/test262/language/rest-parameters/array-pattern.js

raw
1 // Copyright (C) 2015 André Bargull. All rights reserved.
2 // This code is governed by the BSD license found in the LICENSE file.
3
4 /*---
5 esid: sec-destructuring-binding-patterns
6 description: >
7 The rest parameter can be a binding pattern.
8 info: |
9 Destructuring Binding Patterns - Syntax
10
11 BindingRestElement[Yield]:
12 ...BindingPattern[?Yield]
13 ---*/
14
15 function empty(...[]) {}
16
17 function emptyWithArray(...[[]]) {}
18
19 function emptyWithObject(...[{}]) {}
20
21 function emptyWithRest(...[...[]]) {}
22
23 function emptyWithLeading(x, ...[]) {}
24
25
26 function singleElement(...[a]) {}
27
28 function singleElementWithInitializer(...[a = 0]) {}
29
30 function singleElementWithArray(...[[a]]) {}
31
32 function singleElementWithObject(...[{p: q}]) {}
33
34 function singleElementWithRest(...[...a]) {}
35
36 function singleElementWithLeading(x, ...[a]) {}
37
38
39 function multiElement(...[a, b, c]) {}
40
41 function multiElementWithInitializer(...[a = 0, b, c = 1]) {}
42
43 function multiElementWithArray(...[[a], b, [c]]) {}
44
45 function multiElementWithObject(...[{p: q}, {r}, {s = 0}]) {}
46
47 function multiElementWithRest(...[a, b, ...c]) {}
48
49 function multiElementWithLeading(x, y, ...[a, b, c]) {}
50
51 reportCompare(0, 0);