Home | History | Annotate | Download | only in Regress
      1 /*
      2 * The contents of this file are subject to the Netscape Public
      3 * License Version 1.1 (the "License"); you may not use this file
      4 * except in compliance with the License. You may obtain a copy of
      5 * the License at http://www.mozilla.org/NPL/
      6 *
      7 * Software distributed under the License is distributed on an "AS
      8 * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
      9 * implied. See the License for the specific language governing
     10 * rights and limitations under the License.
     11 *
     12 * The Original Code is mozilla.org code.
     13 *
     14 * The Initial Developer of the Original Code is Netscape
     15 * Communications Corporation.  Portions created by Netscape are
     16 * Copyright (C) 1998 Netscape Communications Corporation. All
     17 * Rights Reserved.
     18 *
     19 * Contributor(s): shaver (at) mozilla.org
     20 * Date: 06 Mar 2001
     21 *
     22 * SUMMARY: Propagate heavyweightness back up the function-nesting
     23 * chain. See http://bugzilla.mozilla.org/show_bug.cgi?id=71107
     24 *
     25 */
     26 //-------------------------------------------------------------------------------------------------
     27 var bug = 71107;
     28 var summary = 'Propagate heavyweightness back up the function-nesting chain...';
     29 
     30 
     31 //-------------------------------------------------------------------------------------------------
     32 test();
     33 //-------------------------------------------------------------------------------------------------
     34 
     35 
     36 function test()
     37 {
     38   enterFunc ('test');
     39   printBugNumber (bug);
     40   printStatus (summary);
     41 
     42   var actual = outer()()();  //call the return of calling the return of outer()
     43   var expect = 5;
     44   reportCompare(expect, actual, summary);
     45 
     46   exitFunc ('test');
     47 }
     48 
     49 
     50 function outer () {
     51   var outer_var = 5;
     52 
     53   function inner() {
     54     function way_inner() {
     55       return outer_var;
     56     }
     57     return way_inner;
     58   }
     59   return inner;
     60 }
     61