| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
var gTestfile = 'regress-346642-06.js'; |
| 7 |
|
| 8 |
var BUGNUMBER = 346642; |
| 9 |
var summary = 'decompilation of destructuring assignment'; |
| 10 |
var actual = ''; |
| 11 |
var expect = ''; |
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
test(); |
| 16 |
|
| 17 |
|
| 18 |
function test() |
| 19 |
{ |
| 20 |
enterFunc ('test'); |
| 21 |
printBugNumber(BUGNUMBER); |
| 22 |
printStatus (summary); |
| 23 |
|
| 24 |
expect = 3; |
| 25 |
actual = ''; |
| 26 |
"" + function() { [] = 3 }; actual = 3; |
| 27 |
actual = 3; |
| 28 |
reportCompare(expect, actual, summary + ': 1'); |
| 29 |
|
| 30 |
try |
| 31 |
{ |
| 32 |
var z = 6; |
| 33 |
var f = eval('(function (){for(let [] = []; false;) let z; return z})'); |
| 34 |
expect = f(); |
| 35 |
actual = eval("("+f+")")() |
| 36 |
reportCompare(expect, actual, summary + ': 2'); |
| 37 |
} |
| 38 |
catch(ex) |
| 39 |
{ |
| 40 |
|
| 41 |
var summarytrunk = 'let declaration must be direct child of block or top-level implicit block'; |
| 42 |
expect = 'SyntaxError'; |
| 43 |
actual = ex.name; |
| 44 |
reportCompare(expect, actual, summarytrunk); |
| 45 |
} |
| 46 |
|
| 47 |
expect = 3; |
| 48 |
actual = ''; |
| 49 |
"" + function () { for(;; [[a]] = [5]) { } }; actual = 3; |
| 50 |
reportCompare(expect, actual, summary + ': 3'); |
| 51 |
|
| 52 |
expect = 3; |
| 53 |
actual = ''; |
| 54 |
f = function () { return { set x([a]) { yield; } } } |
| 55 |
var obj = f(); |
| 56 |
uneval(obj); actual = 3; |
| 57 |
reportCompare(expect, actual, summary + ': 4'); |
| 58 |
|
| 59 |
expect = 3; |
| 60 |
actual = ''; |
| 61 |
"" + function () { [y([a]=b)] = z }; actual = 3; |
| 62 |
reportCompare(expect, actual, summary + ': 5'); |
| 63 |
|
| 64 |
expect = 3; |
| 65 |
actual = ''; |
| 66 |
"" + function () { for(;; ([[,]] = p)) { } }; actual = 3; |
| 67 |
reportCompare(expect, actual, summary + ': 6'); |
| 68 |
|
| 69 |
expect = 3; |
| 70 |
actual = ''; |
| 71 |
actual = 1; try {for(x in (function ([y]) { })() ) { }}catch(ex){} actual = 3; |
| 72 |
reportCompare(expect, actual, summary + ': 7'); |
| 73 |
|
| 74 |
exitFunc ('test'); |
| 75 |
} |