summaryrefslogtreecommitdiffstats
path: root/devtools/client/debugger/test/mochitest/code_math.js
blob: f765817bb58f00849861ff1e93d1f01a254368c3 (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
34
35
36
37
38
39
40
41
42
43
44
45
function add(a, b, k) {
  var result = a + b;
  return k(result);
}

function sub(a, b, k) {
  var result = a - b;
  return k(result);
}

function mul(a, b, k) {
  var result = a * b;
  return k(result);
}

function div(a, b, k) {
  var result = a / b;
  return k(result);
}

function arithmetic() {
  add(4, 4, function (a) {
    // 8
    sub(a, 2, function (b) {
      // 6
      mul(b, 3, function (c) {
        // 18
        div(c, 2, function (d) {
          // 9
          console.log(d);
        });
      });
    });
  });
}

// Compile with closure compiler and the following flags:
//
//     --compilation_level WHITESPACE_ONLY
//     --source_map_format V3
//     --create_source_map code_math.map
//     --js_output_file    code_math.min.js
//
// And then append the sourceMappingURL comment directive to code_math.min.js
// manually.