regress-452498-006.js (1023B)
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 = 452498; 8 var summary = 'TM: upvar2 regression tests'; 9 var actual = ''; 10 var expect = ''; 11 12 13 //----------------------------------------------------------------------------- 14 test(); 15 //----------------------------------------------------------------------------- 16 17 function test() 18 { 19 printBugNumber(BUGNUMBER); 20 printStatus (summary); 21 22 // ------- Comment #6 From Andreas Gal :gal 23 24 function foo() { 25 var x = 4; 26 var f = (function() { return x++; }); 27 var g = (function() { return x++; }); 28 return [f,g]; 29 } 30 31 var bar = foo(); 32 33 expect = '9'; 34 actual = 0; 35 36 bar[0](); 37 bar[1](); 38 39 actual = String(expect); 40 41 reportCompare(expect, actual, summary); 42 }