tor-browser

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

var-env-func-init-local-update.js (1107B)


      1 // Copyright (C) 2016 the V8 project authors. All rights reserved.
      2 // This code is governed by the BSD license found in the LICENSE file.
      3 /*---
      4 esid: sec-evaldeclarationinstantiation
      5 description: Re-declaration of an existing local variable binding
      6 info: |
      7    [...]
      8    15. For each production f in functionsToInitialize, do
      9        a. Let fn be the sole element of the BoundNames of f.
     10        b. Let fo be the result of performing InstantiateFunctionObject for f
     11           with argument lexEnv.
     12        c. If varEnvRec is a global Environment Record, then
     13           [...]
     14        d. Else,
     15           i. Let bindingExists be varEnvRec.HasBinding(fn).
     16           ii. If bindingExists is false, then
     17               [...]
     18           iii. Else,
     19                1. Perform ! varEnvRec.SetMutableBinding(fn, fo, false).
     20    [...]
     21 flags: [noStrict]
     22 ---*/
     23 
     24 var initial;
     25 
     26 (function() {
     27  var f = 88;
     28  eval('initial = f; function f() { return 33; }');
     29 }());
     30 
     31 assert.sameValue(typeof initial, 'function');
     32 assert.sameValue(initial(), 33);
     33 assert.throws(ReferenceError, function() {
     34  f;
     35 });
     36 
     37 reportCompare(0, 0);