tor-browser

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

script-decl-lex-collision.js (670B)


      1 // Copyright (C) 2023 Alexey Shvayka. All rights reserved.
      2 // This code is governed by the BSD license found in the LICENSE file.
      3 /*---
      4 esid: sec-globaldeclarationinstantiation
      5 description: Let binding collision with existing var declaration that was created for hoisted function.
      6 info: |
      7  [...]
      8  3. For each element name of lexNames, do
      9    a. If env.HasVarDeclaration(name) is true, throw a SyntaxError exception.
     10 flags: [noStrict]
     11 ---*/
     12 
     13 if (true) {
     14  function test262Fn() {}
     15 }
     16 
     17 assert.throws(SyntaxError, function() {
     18  $262.evalScript('var x; let test262Fn;');
     19 });
     20 
     21 assert.throws(ReferenceError, function() {
     22  x;
     23 }, 'no bindings created');
     24 
     25 reportCompare(0, 0);