| 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 | gTestfile = 'regress-144834.js'; |
| 17 | var BUGNUMBER = 144834; |
| 18 | var summary = 'Local var having same name as switch label inside function'; |
| 19 | |
| 20 | print(BUGNUMBER); |
| 21 | print(summary); |
| 22 | |
| 23 | |
| 24 | function RedrawSched() |
| 25 | { |
| 26 | var MinBound; |
| 27 | |
| 28 | switch (i) |
| 29 | { |
| 30 | case MinBound : |
| 31 | } |
| 32 | } |
| 33 | |
| 34 | |
| 35 | /* |
| 36 | * Also try eval scope - |
| 37 | */ |
| 38 | var s = ''; |
| 39 | s += 'function RedrawSched()'; |
| 40 | s += '{'; |
| 41 | s += ' var MinBound;'; |
| 42 | s += ''; |
| 43 | s += ' switch (i)'; |
| 44 | s += ' {'; |
| 45 | s += ' case MinBound :'; |
| 46 | s += ' }'; |
| 47 | s += '}'; |
| 48 | eval(s); |
| 49 | |
| 50 | AddTestCase('Do not crash', 'No Crash', 'No Crash'); |
| 51 | test(); |