|
1 // Copyright 2009 the Sputnik authors. All rights reserved. |
|
2 // This code is governed by the BSD license found in the LICENSE file. |
|
3 |
|
4 /** |
|
5 * Every function call enters a new execution context |
|
6 * |
|
7 * @path ch10/10.4/S10.4A1.1_T2.js |
|
8 * @description Recursive function call |
|
9 */ |
|
10 |
|
11 var y; |
|
12 |
|
13 function f(a){ |
|
14 var x; |
|
15 |
|
16 if (a === 1) |
|
17 return x; |
|
18 else { |
|
19 if(x === undefined) { |
|
20 x = 0; |
|
21 } else { |
|
22 x = 1; |
|
23 } |
|
24 return f(1); |
|
25 } |
|
26 } |
|
27 |
|
28 y = f(0); |
|
29 |
|
30 if(!(y === undefined)){ |
|
31 $ERROR("#1: Recursive function calls shares execution context"); |
|
32 } |
|
33 |