obj-ptrn-prop-id-init-skipped.js (1477B)
1 // This file was procedurally generated from the following sources: 2 // - src/dstr-binding/obj-ptrn-prop-id-init-skipped.case 3 // - src/dstr-binding/default/try.template 4 /*--- 5 description: Destructuring initializer is not evaluated when value is not `undefined` (try statement) 6 esid: sec-runtime-semantics-catchclauseevaluation 7 features: [destructuring-binding] 8 flags: [generated] 9 info: | 10 Catch : catch ( CatchParameter ) Block 11 12 [...] 13 5. Let status be the result of performing BindingInitialization for 14 CatchParameter passing thrownValue and catchEnv as arguments. 15 [...] 16 17 13.3.3.7 Runtime Semantics: KeyedBindingInitialization 18 19 BindingElement : BindingPattern Initializeropt 20 21 [...] 22 3. If Initializer is present and v is undefined, then 23 [...] 24 ---*/ 25 var initCount = 0; 26 function counter() { 27 initCount += 1; 28 } 29 30 var ranCatch = false; 31 32 try { 33 throw { s: null, u: 0, w: false, y: '' }; 34 } catch ({ s: t = counter(), u: v = counter(), w: x = counter(), y: z = counter() }) { 35 assert.sameValue(t, null); 36 assert.sameValue(v, 0); 37 assert.sameValue(x, false); 38 assert.sameValue(z, ''); 39 assert.sameValue(initCount, 0); 40 41 assert.throws(ReferenceError, function() { 42 s; 43 }); 44 assert.throws(ReferenceError, function() { 45 u; 46 }); 47 assert.throws(ReferenceError, function() { 48 w; 49 }); 50 assert.throws(ReferenceError, function() { 51 y; 52 }); 53 ranCatch = true; 54 } 55 56 assert(ranCatch, 'executed `catch` block'); 57 58 reportCompare(0, 0);