regress-346642-06.js (1774B)
1 /* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */ 2 /* This Source Code Form is subject to the terms of the Mozilla Public 3 * License, v. 2.0. If a copy of the MPL was not distributed with this 4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 5 6 //----------------------------------------------------------------------------- 7 var BUGNUMBER = 346642; 8 var summary = 'decompilation of destructuring assignment'; 9 var actual = ''; 10 var expect = ''; 11 12 13 //----------------------------------------------------------------------------- 14 test(); 15 //----------------------------------------------------------------------------- 16 17 function test() 18 { 19 printBugNumber(BUGNUMBER); 20 printStatus (summary); 21 22 expect = 3; 23 actual = ''; 24 "" + function() { [] = 3 }; actual = 3; 25 actual = 3; 26 reportCompare(expect, actual, summary + ': 1'); 27 28 try 29 { 30 var z = 6; 31 var f = eval('(function (){for(let [] = []; false;) let z; return z})'); 32 expect = f(); 33 actual = eval("("+f+")")() 34 reportCompare(expect, actual, summary + ': 2'); 35 } 36 catch(ex) 37 { 38 // See https://bugzilla.mozilla.org/show_bug.cgi?id=408957 39 var summarytrunk = 'let declaration must be direct child of block or top-level implicit block'; 40 expect = 'SyntaxError'; 41 actual = ex.name; 42 reportCompare(expect, actual, summarytrunk); 43 } 44 45 expect = 3; 46 actual = ''; 47 "" + function () { for(;; [[a]] = [5]) { } }; actual = 3; 48 reportCompare(expect, actual, summary + ': 3'); 49 50 expect = 3; 51 actual = ''; 52 "" + function () { for(;; ([[,]] = p)) { } }; actual = 3; 53 reportCompare(expect, actual, summary + ': 4'); 54 55 expect = 3; 56 actual = ''; 57 actual = 1; try {for(x in (function ([y]) { })() ) { }}catch(ex){} actual = 3; 58 reportCompare(expect, actual, summary + ': 5'); 59 }