summaryrefslogtreecommitdiffstats
path: root/js/src/jit-test/tests/arguments/dynamicBindings.js
blob: 326038e12bcae7a820610d9c3fa3c19a3d23747f (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
function testEval(x, y) {
  x = 5;
  eval("arguments[0] += 10");
  assertEq(x, 15);
}
for (var i = 0; i < 5; i++)
  testEval(3);

function testEvalWithArguments(x, y) {
  eval("arguments[0] += 10");
  assertEq(arguments[y], 13);
}
for (var i = 0; i < 5; i++)
  testEvalWithArguments(3, 0);

function testNestedEval(x, y) {
  x = 5;
  eval("eval('arguments[0] += 10')");
  assertEq(x, 15);
}
for (var i = 0; i < 5; i++)
  testNestedEval(3);

function testWith(x, y) {
  with ({}) {
    arguments[0] += 10;
    assertEq(x, 13);
  }
}
for (var i = 0; i < 5; i++)
  testWith(3);