summaryrefslogtreecommitdiffstats
path: root/js/src/tests/ecma_6/LexicalEnvironment/var-in-catch-body-annex-b-eval.js
blob: e380846e2522eafbe90a203004dcaf71deb0592e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
// Tests annex B.3.5 that introduces a var via direct eval.

var x = "global-x";
var log = "";

// Tests that direct eval works.
function g() {
  try { throw 8; } catch (x) {
    eval("var x = 42;");
    log += x;
  }
  x = "g";
  log += x;
}
g();

assertEq(x, "global-x");
assertEq(log, "42g");

if ("reportCompare" in this)
  reportCompare(true, true)