summaryrefslogtreecommitdiffstats
path: root/js/src/jit-test/tests/closures/nameinc-loop-3.js
blob: 08a7d56ff2d53491f3c00b388d99f47ff13c03ef (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
actual = '';
expected = 'g 1 0,g 2 -1,g 3 -2,g 4 -3,g 5 -4,h 5 -5,f 5,undefined,g 1 0,g 2 -1,g 3 -2,g 4 -3,g 5 -4,h 5 -5,f 5,undefined,g 1 0,g 2 -1,g 3 -2,g 4 -3,g 5 -4,h 5 -5,f 5,undefined,g 1 0,g 2 -1,g 3 -2,g 4 -3,g 5 -4,h 5 -5,f 5,undefined,g 1 0,g 2 -1,g 3 -2,g 4 -3,g 5 -4,h 5 -5,f 5,undefined,';

var f = function() {
  var p = 0;

  function h() {
    var q = 0;

    function g() {
      for (var i = 0; i < 5; ++i) {
	p++;
	appendToActual('g ' + p + ' ' + q);
	q--;
      }
    }
    g();
    appendToActual('h ' + p + ' ' + q);
  }
  
  h();
  
  appendToActual('f ' + p);
}

for (var i = 0; i < 5; ++i) {
  f();
  appendToActual();
}



assertEq(actual, expected)