tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

catch-redeclared-var-statement-captured.js (550B)


      1 // Copyright (c) 2012 Ecma International.  All rights reserved.
      2 // This code is governed by the BSD license found in the LICENSE file.
      3 
      4 /*---
      5 es5id: 12.14-2
      6 es6id: B.3.5
      7 description: >
      8    catch doesn't change declaration scope - var initializer in catch
      9    with same name as catch parameter changes parameter
     10 ---*/
     11 
     12  function capturedFoo() {return foo};
     13  foo = "prior to throw";
     14  try {
     15    throw new Error();
     16  }
     17  catch (foo) {
     18    var foo = "initializer in catch";
     19  }
     20 
     21 assert.sameValue(capturedFoo(), "prior to throw");
     22 
     23 reportCompare(0, 0);