| 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-376410.js'; |
| 7 | //----------------------------------------------------------------------------- |
| 8 | var BUGNUMBER = 376410; |
| 9 | var summary = 'let declaration must be direct child of block, ' + |
| 10 | 'top-level implicit block, or switch body block'; |
| 11 | var actual = ''; |
| 12 | var expect = 'SyntaxError'; |
| 13 | |
| 14 | // See https://bugzilla.mozilla.org/show_bug.cgi?id=408957 |
| 15 | |
| 16 | //----------------------------------------------------------------------------- |
| 17 | test(); |
| 18 | //----------------------------------------------------------------------------- |
| 19 | |
| 20 | function test() |
| 21 | { |
| 22 | enterFunc ('test'); |
| 23 | printBugNumber(BUGNUMBER); |
| 24 | printStatus (summary); |
| 25 | |
| 26 | try |
| 27 | { |
| 28 | eval('(function() { while(0) L: let x; print(x); })'); |
| 29 | } |
| 30 | catch(ex) |
| 31 | { |
| 32 | actual = ex.name; |
| 33 | } |
| 34 | |
| 35 | reportCompare(expect, actual, summary); |
| 36 | |
| 37 | exitFunc ('test'); |
| 38 | } |