regress-369666-01.js (1162B)
1 /* -*- indent-tabs-mode: nil; js-indent-level: 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 var BUGNUMBER = 369666; 8 var summary = 'inner function declaration in let-induced outer ' + 9 'function body gets wrong scope.'; 10 var actual = 'No Crash'; 11 var expect = 'No Crash'; 12 13 14 //----------------------------------------------------------------------------- 15 test(); 16 //----------------------------------------------------------------------------- 17 18 function test() 19 { 20 printBugNumber(BUGNUMBER); 21 printStatus (summary); 22 23 function foo() { 24 let x = 42 25 26 function bar() { 27 return x; 28 } 29 30 return bar; 31 } 32 33 print(foo()()); 34 35 baz = false; 36 37 function foo2() { 38 let x = 42 39 40 function bar() { 41 return x; 42 } 43 44 try { 45 if (baz) 46 return bar; 47 } finally { 48 print('finally', x); 49 } 50 return bar; 51 } 52 53 print(foo2()()); 54 55 reportCompare(expect, actual, summary); 56 }