|
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 /* |
|
7 * |
|
8 * Date: 05 July 2002 |
|
9 * SUMMARY: Testing local var having same name as switch label inside function |
|
10 * |
|
11 * The code below crashed while compiling in JS1.1 or JS1.2 |
|
12 * See http://bugzilla.mozilla.org/show_bug.cgi?id=144834 |
|
13 * |
|
14 */ |
|
15 //----------------------------------------------------------------------------- |
|
16 var BUGNUMBER = 144834; |
|
17 var summary = 'Local var having same name as switch label inside function'; |
|
18 |
|
19 print(BUGNUMBER); |
|
20 print(summary); |
|
21 |
|
22 |
|
23 function RedrawSched() |
|
24 { |
|
25 var MinBound; |
|
26 |
|
27 switch (i) |
|
28 { |
|
29 case MinBound : |
|
30 } |
|
31 } |
|
32 |
|
33 |
|
34 /* |
|
35 * Also try eval scope - |
|
36 */ |
|
37 var s = ''; |
|
38 s += 'function RedrawSched()'; |
|
39 s += '{'; |
|
40 s += ' var MinBound;'; |
|
41 s += ''; |
|
42 s += ' switch (i)'; |
|
43 s += ' {'; |
|
44 s += ' case MinBound :'; |
|
45 s += ' }'; |
|
46 s += '}'; |
|
47 eval(s); |
|
48 |
|
49 AddTestCase('Do not crash', 'No Crash', 'No Crash'); |
|
50 test(); |