Debian Codegraph @

rhino/testsrc/tests/js1_7/regress/regress-372331.js

raw symbols SCIP
1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 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 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 }