tor-browser

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

switch-case-global-existing-fn-no-init.js (768B)


      1 // This file was procedurally generated from the following sources:
      2 // - src/annex-b-fns/global-existing-fn-no-init.case
      3 // - src/annex-b-fns/global/switch-case.template
      4 /*---
      5 description: Existing variable binding is not modified (Function declaration in the `case` clause of a `switch` statement in the global scope)
      6 esid: sec-web-compat-globaldeclarationinstantiation
      7 flags: [generated, noStrict]
      8 info: |
      9    B.3.3.2 Changes to GlobalDeclarationInstantiation
     10 
     11    [...]
     12    1. Let fnDefinable be ? envRec.CanDeclareGlobalFunction(F).
     13    2. If fnDefinable is true, then
     14 ---*/
     15 assert.sameValue(f(), 'outer declaration');
     16 
     17 switch (1) {
     18  case 1:
     19    function f() { return 'inner declaration'; }
     20 }
     21 
     22 function f() {
     23  return 'outer declaration';
     24 }
     25 
     26 reportCompare(0, 0);