tor-browser

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

switch-case-func-existing-fn-no-init.js (793B)


      1 // This file was procedurally generated from the following sources:
      2 // - src/annex-b-fns/func-existing-fn-no-init.case
      3 // - src/annex-b-fns/func/switch-case.template
      4 /*---
      5 description: Existing variable binding is not modified (Function declaration in the `case` clause of a `switch` statement in function scope)
      6 esid: sec-web-compat-functiondeclarationinstantiation
      7 flags: [generated, noStrict]
      8 info: |
      9    B.3.3.1 Changes to FunctionDeclarationInstantiation
     10 
     11    [...]
     12    2. If instantiatedVarNames does not contain F, then
     13    [...]
     14 ---*/
     15 var init;
     16 
     17 (function() {
     18  init = f;
     19 
     20  switch (1) {
     21    case 1:
     22      function f() { return 'inner declaration'; }
     23  }
     24 
     25  function f() {
     26    return 'outer declaration';
     27  }
     28 }());
     29 
     30 assert.sameValue(init(), 'outer declaration');
     31 
     32 reportCompare(0, 0);