| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
var gTestfile = 'regress-346642-01.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 |
var f; |
| 25 |
|
| 26 |
f = function () {({a:{c:x}, b:x}) = ({b:3})} |
| 27 |
expect = 'function () {({a:{c:x}, b:x} = {b:3});}'; |
| 28 |
actual = f + ''; |
| 29 |
compareSource(expect, actual, summary + ': 1'); |
| 30 |
|
| 31 |
f = function() { for(; let (x=3,y=4) null;) { } } |
| 32 |
expect = 'function() { for(; let (x=3,y=4) null;) { } }'; |
| 33 |
actual = f + ''; |
| 34 |
compareSource(expect, actual, summary + ': 2'); |
| 35 |
|
| 36 |
f = function() { let (x=3,y=4) { } x = 5; } |
| 37 |
expect = 'function() { let (x=3,y=4) { } x = 5; }'; |
| 38 |
actual = f + ''; |
| 39 |
compareSource(expect, actual, summary + ': 3'); |
| 40 |
|
| 41 |
f = function () { for ([11].x;;) break; } |
| 42 |
expect = 'function () { for ([11].x;;) { break;} }'; |
| 43 |
actual = f + ''; |
| 44 |
compareSource(expect, actual, summary + ': 4'); |
| 45 |
|
| 46 |
f = function() { new ({ a: b } = c) } |
| 47 |
expect = 'function() { new ({ a: b } = c); }'; |
| 48 |
actual = f + ''; |
| 49 |
compareSource(expect, actual, summary + ': 5'); |
| 50 |
|
| 51 |
f = function () { (let (x) 3)(); } |
| 52 |
expect = 'function () { (let (x) 3)(); }'; |
| 53 |
actual = f + ''; |
| 54 |
compareSource(expect, actual, summary + ': 6'); |
| 55 |
|
| 56 |
f = function () { (let (x) 3).foo(); } |
| 57 |
expect = 'function () { (let (x) 3).foo(); }'; |
| 58 |
actual = f + ''; |
| 59 |
compareSource(expect, actual, summary + ': 7'); |
| 60 |
|
| 61 |
f = function () { ({x: a(b)}) = window; } |
| 62 |
expect = 'function () { ({x: a(b)} = window); }'; |
| 63 |
actual = f + ''; |
| 64 |
compareSource(expect, actual, summary + ': 8'); |
| 65 |
|
| 66 |
f = function() { let ([a]=x) { } } |
| 67 |
expect = 'function() { let ([a]=x) { } }'; |
| 68 |
actual = f + ''; |
| 69 |
compareSource(expect, actual, summary + ': 9'); |
| 70 |
|
| 71 |
f = function( ){ new ([x] = k) } |
| 72 |
expect = 'function( ){ new ([x] = k); }'; |
| 73 |
actual = f + ''; |
| 74 |
compareSource(expect, actual, summary + ': 10'); |
| 75 |
|
| 76 |
f = function() { [a] = [b] = c } |
| 77 |
expect = 'function() { [a] = [b] = c; }'; |
| 78 |
actual = f + ''; |
| 79 |
compareSource(expect, actual, summary + ': 11'); |
| 80 |
|
| 81 |
f = function() { [] = 3 } |
| 82 |
expect = 'function() { [] = 3; }'; |
| 83 |
actual = f + ''; |
| 84 |
compareSource(expect, actual, summary + ': 12'); |
| 85 |
|
| 86 |
f = function() { ({}) = 3 } |
| 87 |
expect = 'function() { [] = 3; }'; |
| 88 |
actual = f + ''; |
| 89 |
compareSource(expect, actual, summary + ': 13'); |
| 90 |
|
| 91 |
f = function () { while( {} = e ) ; } |
| 92 |
expect = 'function () { while( [] = e ) {} }'; |
| 93 |
actual = f + ''; |
| 94 |
compareSource(expect, actual, summary + ': 14'); |
| 95 |
|
| 96 |
f = function () { while( {} = (a)(b) ) ; } |
| 97 |
expect = 'function () { while( [] = a(b) ) {} }'; |
| 98 |
actual = f + ''; |
| 99 |
compareSource(expect, actual, summary + ': 15'); |
| 100 |
|
| 101 |
f = function (){[] = [a,b,c]} |
| 102 |
expect = 'function (){[] = [a,b,c];}'; |
| 103 |
actual = f + ''; |
| 104 |
compareSource(expect, actual, summary + ': 16'); |
| 105 |
|
| 106 |
f = function (){for([] = [a,b,c];;);} |
| 107 |
expect = 'function (){for([] = [a,b,c];;){}}'; |
| 108 |
actual = f + ''; |
| 109 |
compareSource(expect, actual, summary + ': 17'); |
| 110 |
|
| 111 |
f = function (){for(;;[] = [a,b,c]);} |
| 112 |
expect = 'function (){for(;;[] = [a,b,c]){}}'; |
| 113 |
actual = f + ''; |
| 114 |
compareSource(expect, actual, summary + ': 18'); |
| 115 |
|
| 116 |
f = function (){for(let [] = [a,b,c];;);} |
| 117 |
expect = 'function (){for(let [] = [a,b,c];;){}}'; |
| 118 |
actual = f + ''; |
| 119 |
compareSource(expect, actual, summary + ': 19'); |
| 120 |
|
| 121 |
f = function() { for (;; [x] = [1]) { } } |
| 122 |
expect = 'function() { for (;; [x] = [1]) { } } '; |
| 123 |
actual = f + ''; |
| 124 |
compareSource(expect, actual, summary + ': 20'); |
| 125 |
|
| 126 |
f = function() { [g['//']] = h } |
| 127 |
expect = 'function() { [g["//"]] = h; }'; |
| 128 |
actual = f + ''; |
| 129 |
compareSource(expect, actual, summary + ': 21'); |
| 130 |
|
| 131 |
f = (function() { for ( let [a,b]=[c,d] in [3]) { } }) |
| 132 |
expect = 'function() { [c, d]; for ( let [a,b] in [3]) { } }'; |
| 133 |
actual = f + ''; |
| 134 |
compareSource(expect, actual, summary + ': 22'); |
| 135 |
|
| 136 |
f = function () { while(1) [a] = [b]; } |
| 137 |
expect = 'function () { while(1) {[a] = [b];} } '; |
| 138 |
actual = f + ''; |
| 139 |
compareSource(expect, actual, summary + ': 23'); |
| 140 |
|
| 141 |
f = function () { for(var [x, y] = r in p) { } } |
| 142 |
expect = 'function () { var [x, y] = r; for( [x, y] in p) { } }'; |
| 143 |
actual = f + ''; |
| 144 |
compareSource(expect, actual, summary + ': 24'); |
| 145 |
|
| 146 |
f = function() { for([x] = [];;) { } } |
| 147 |
expect = 'function() { for([x] = [];;) { } }'; |
| 148 |
actual = f + ''; |
| 149 |
compareSource(expect, actual, summary + ': 25'); |
| 150 |
|
| 151 |
f = function () { let ([y] = delete [1]) { } } |
| 152 |
expect = 'function () { let ([y] = ([1], true)) { } }'; |
| 153 |
actual = f + ''; |
| 154 |
compareSource(expect, actual, summary + ': 26'); |
| 155 |
|
| 156 |
f = function () { delete 4..x } |
| 157 |
expect = 'function () { delete (4).x; }'; |
| 158 |
actual = f + ''; |
| 159 |
compareSource(expect, actual, summary + ': 27'); |
| 160 |
|
| 161 |
f = function() { return [({ x: y }) = p for (z in 5)] } |
| 162 |
expect = 'function() { return [{ x: y } = p for (z in 5)]; }'; |
| 163 |
actual = f + ''; |
| 164 |
compareSource(expect, actual, summary + ': 1'); |
| 165 |
|
| 166 |
exitFunc ('test'); |
| 167 |
} |