| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
var gTestfile = 'regress-351070-03.js'; |
| 7 |
|
| 8 |
var BUGNUMBER = 351070; |
| 9 |
var summary = 'decompilation of let declaration should not change scope'; |
| 10 |
var summarytrunk = 'let declaration must be direct child of block or top-level implicit block'; |
| 11 |
var actual = ''; |
| 12 |
var expect = ''; |
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
test(); |
| 17 |
|
| 18 |
|
| 19 |
function test() |
| 20 |
{ |
| 21 |
enterFunc ('test'); |
| 22 |
printBugNumber(BUGNUMBER); |
| 23 |
printStatus (summary); |
| 24 |
|
| 25 |
var c; |
| 26 |
var f; |
| 27 |
|
| 28 |
try |
| 29 |
{ |
| 30 |
c = '(function (x){if (x) if (y) z; else let w })'; |
| 31 |
f = eval(c); |
| 32 |
expect = 'function (x){if (x) {if (y) { z; } else let w; }}'; |
| 33 |
actual = f + ''; |
| 34 |
compareSource(expect, actual, summary); |
| 35 |
} |
| 36 |
catch(ex) |
| 37 |
{ |
| 38 |
|
| 39 |
expect = 'SyntaxError'; |
| 40 |
actual = ex.name; |
| 41 |
reportCompare(expect, actual, summarytrunk + ': ' + c); |
| 42 |
} |
| 43 |
|
| 44 |
try |
| 45 |
{ |
| 46 |
c = '(function (x){if (x){ if (y) z;} else let w })'; |
| 47 |
f = eval(c); |
| 48 |
expect = 'function (x){if (x){ if (y) {z;}} else let w; }'; |
| 49 |
actual = f + ''; |
| 50 |
compareSource(expect, actual, summary); |
| 51 |
} |
| 52 |
catch(ex) |
| 53 |
{ |
| 54 |
|
| 55 |
expect = 'SyntaxError'; |
| 56 |
actual = ex.name; |
| 57 |
reportCompare(expect, actual, summarytrunk + ': ' + c); |
| 58 |
} |
| 59 |
|
| 60 |
try |
| 61 |
{ |
| 62 |
c = '(function (x){if (x){ if (y) let z;} else let w })'; |
| 63 |
f = eval(c); |
| 64 |
expect = 'function (x){if (x){ if (y) let z;} else let w; }'; |
| 65 |
actual = f + ''; |
| 66 |
compareSource(expect, actual, summary); |
| 67 |
} |
| 68 |
catch(ex) |
| 69 |
{ |
| 70 |
|
| 71 |
expect = 'SyntaxError'; |
| 72 |
actual = ex.name; |
| 73 |
reportCompare(expect, actual, summarytrunk + ': ' + c); |
| 74 |
} |
| 75 |
|
| 76 |
try |
| 77 |
{ |
| 78 |
c = '(function f(){var a = 2; if (x) {let a = 3; print(a)} return a})'; |
| 79 |
f = eval(c); |
| 80 |
expect = 'function f(){var a = 2; if (x) {let a = 3; print(a);} return a;}'; |
| 81 |
actual = f + ''; |
| 82 |
compareSource(expect, actual, summary); |
| 83 |
} |
| 84 |
catch(ex) |
| 85 |
{ |
| 86 |
|
| 87 |
expect = 'SyntaxError'; |
| 88 |
actual = ex.name; |
| 89 |
reportCompare(expect, actual, summarytrunk + ': ' + c); |
| 90 |
} |
| 91 |
|
| 92 |
try |
| 93 |
{ |
| 94 |
c = '(function f(){var a = 2; if (x) {print(a);let a = 3} return a})'; |
| 95 |
f = eval(c); |
| 96 |
expect = 'function f(){var a = 2; if (x) {print(a);let a = 3;} return a;}'; |
| 97 |
actual = f + ''; |
| 98 |
compareSource(expect, actual, summary); |
| 99 |
} |
| 100 |
catch(ex) |
| 101 |
{ |
| 102 |
|
| 103 |
expect = 'SyntaxError'; |
| 104 |
actual = ex.name; |
| 105 |
reportCompare(expect, actual, summarytrunk + ': ' + c); |
| 106 |
} |
| 107 |
|
| 108 |
try |
| 109 |
{ |
| 110 |
c = '(function f(){var a = 2; if (x) {let a = 3} return a})'; |
| 111 |
f = eval(c); |
| 112 |
expect = 'function f(){var a = 2; if (x) {let a = 3;} return a;}'; |
| 113 |
actual = f + ''; |
| 114 |
compareSource(expect, actual, summary); |
| 115 |
} |
| 116 |
catch(ex) |
| 117 |
{ |
| 118 |
|
| 119 |
expect = 'SyntaxError'; |
| 120 |
actual = ex.name; |
| 121 |
reportCompare(expect, actual, summarytrunk + ': ' + c); |
| 122 |
} |
| 123 |
|
| 124 |
try |
| 125 |
{ |
| 126 |
c = '(function f(){var a = 2; if (x) let a = 3; return a})'; |
| 127 |
f = eval(c); |
| 128 |
expect = 'function f(){var a = 2; if (x) let a = 3; return a;}'; |
| 129 |
actual = f + ''; |
| 130 |
compareSource(expect, actual, summary); |
| 131 |
} |
| 132 |
catch(ex) |
| 133 |
{ |
| 134 |
|
| 135 |
expect = 'SyntaxError'; |
| 136 |
actual = ex.name; |
| 137 |
reportCompare(expect, actual, summarytrunk + ': ' + c); |
| 138 |
} |
| 139 |
|
| 140 |
exitFunc ('test'); |
| 141 |
} |