summaryrefslogtreecommitdiffstats
path: root/js/src/jit-test/tests/basic/letTDZEffectful.js
blob: 62245d8c16bec4ee7827f7335442a6fd23f0a8dd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
function assertThrowsReferenceError(f) {
  var e = null;
  try {
    f();
  } catch (ex) {
    e = ex;
  }
  assertEq(e instanceof ReferenceError, true);
}

// TDZ is effectful, don't optimize out x.
assertThrowsReferenceError(function () { x; let x; });
assertThrowsReferenceError(function () { x; const x = undefined; });