| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
var gTestfile = 'regress-372331.js'; |
| 7 |
|
| 8 |
var BUGNUMBER = 372331; |
| 9 |
var summary = 'for-in should not bind name too early'; |
| 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 index; |
| 25 |
var obj = { index: 1 }; |
| 26 |
|
| 27 |
expect = 'No Error'; |
| 28 |
actual = 'No Error'; |
| 29 |
|
| 30 |
function gen() |
| 31 |
{ |
| 32 |
delete obj.index; |
| 33 |
yield 2; |
| 34 |
} |
| 35 |
|
| 36 |
with (obj) { |
| 37 |
for (index in gen()); |
| 38 |
} |
| 39 |
|
| 40 |
try |
| 41 |
{ |
| 42 |
if ('index' in obj) |
| 43 |
throw "for-in binds name to early"; |
| 44 |
|
| 45 |
if (index !== 2) |
| 46 |
throw "unexpected value of index: "+index; |
| 47 |
} |
| 48 |
catch(ex) |
| 49 |
{ |
| 50 |
actual = ex + ''; |
| 51 |
} |
| 52 |
|
| 53 |
reportCompare(expect, actual, summary); |
| 54 |
|
| 55 |
exitFunc ('test'); |
| 56 |
} |