tor-browser

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

block-decl-func-init.js (1044B)


      1 // This file was procedurally generated from the following sources:
      2 // - src/annex-b-fns/func-init.case
      3 // - src/annex-b-fns/func/block.template
      4 /*---
      5 description: Variable binding is initialized to `undefined` in outer scope (Block statement in function scope containing a function declaration)
      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       a. Perform ! varEnvRec.CreateMutableBinding(F, false).
     14       b. Perform varEnvRec.InitializeBinding(F, undefined).
     15       c. Append F to instantiatedVarNames.
     16    [...]
     17 ---*/
     18 var init, changed;
     19 
     20 (function() {
     21  init = f;
     22  f = 123;
     23  changed = f;
     24 
     25  {
     26    function f() {  }
     27  }
     28 
     29  
     30 }());
     31 
     32 assert.sameValue(init, undefined, 'binding is initialized to `undefined`');
     33 assert.sameValue(changed, 123, 'binding is mutable');
     34 assert.throws(ReferenceError, function() {
     35  f;
     36 }, 'global binding is not created');
     37 
     38 reportCompare(0, 0);