Debian Codegraph @

js/src/tests/test262/language/destructuring/binding/syntax/property-list-bindings-elements.js

raw
1 // Copyright (C) 2015 the V8 project authors. All rights reserved.
2 // This code is governed by the BSD license found in the LICENSE file.
3
4 /*---
5 es6id: 13.3.3
6 description: >
7 The ObjectBindingPattern with binding elements
8 info: |
9 Destructuring Binding Patterns - Syntax
10
11 ObjectBindingPattern[Yield] :
12 { }
13 { BindingPropertyList[?Yield] }
14 { BindingPropertyList[?Yield] , }
15
16 BindingPropertyList[Yield] :
17 BindingProperty[?Yield]
18 BindingPropertyList[?Yield] , BindingProperty[?Yield]
19
20 BindingProperty[Yield] :
21 SingleNameBinding[?Yield]
22 PropertyName[?Yield] : BindingElement[?Yield]
23
24 BindingElement[Yield ] :
25 SingleNameBinding[?Yield]
26 BindingPattern[?Yield] Initializer[In, ?Yield]opt
27
28 SingleNameBinding[Yield] :
29 BindingIdentifier[?Yield] Initializer[In, ?Yield]opt
30
31 features: [destructuring-binding]
32 ---*/
33
34 // BindingElement w/ SingleNameBinding
35 function fna({x: y}) {}
36
37 // BindingElement w/ SingleNameBinding with initializer
38 function fnb({x: y = 42}) {}
39
40 // BindingElement w/ BindingPattern
41 function fnc({x: {}}) {}
42 function fnd({x: {y}}) {}
43
44 // BindingElement w/ BindingPattern w/ initializer
45 function fne({x: {} = 42}) {}
46 function fnf({x: {y} = 42}) {}
47
48 reportCompare(0, 0);