tor-browser

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

func-switch-case-eval-func-existing-var-no-init.js (760B)


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