| 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 | * Date: 06 Mar 2001 |
| 8 | * |
| 9 | * SUMMARY: Propagate heavyweightness back up the function-nesting |
| 10 | * chain. See http://bugzilla.mozilla.org/show_bug.cgi?id=71107 |
| 11 | * |
| 12 | */ |
| 13 | //----------------------------------------------------------------------------- |
| 14 | var gTestfile = 'regress-71107.js'; |
| 15 | var BUGNUMBER = 71107; |
| 16 | var summary = 'Propagate heavyweightness back up the function-nesting chain.'; |
| 17 | |
| 18 | //----------------------------------------------------------------------------- |
| 19 | test(); |
| 20 | //----------------------------------------------------------------------------- |
| 21 | |
| 22 | |
| 23 | function test() |
| 24 | { |
| 25 | enterFunc ('test'); |
| 26 | printBugNumber(BUGNUMBER); |
| 27 | printStatus (summary); |
| 28 | |
| 29 | var actual = outer()()(); //call the return of calling the return of outer() |
| 30 | var expect = 5; |
| 31 | reportCompare(expect, actual, summary); |
| 32 | |
| 33 | exitFunc ('test'); |
| 34 | } |
| 35 | |
| 36 | |
| 37 | function outer () { |
| 38 | var outer_var = 5; |
| 39 | |
| 40 | function inner() { |
| 41 | function way_inner() { |
| 42 | return outer_var; |
| 43 | } |
| 44 | return way_inner; |
| 45 | } |
| 46 | return inner; |
| 47 | } |