2 // Copyright (C) 2016 the V8 project authors. All rights reserved.
3 // This code is governed by the BSD license found in the LICENSE file.
6 Mutable bindings are initialized in the lexical environment record prior to
7 execution for function declarations
8 esid: sec-moduledeclarationinstantiation
11 17. For each element d in lexDeclarations do
12 a. For each element dn of the BoundNames of d do
13 i. If IsConstantDeclaration of d is true, then
16 1. Perform ! envRec.CreateMutableBinding(dn, false).
17 iii. If d is a GeneratorDeclaration production or a
18 FunctionDeclaration production, then
19 1. Let fo be the result of performing InstantiateFunctionObject
20 for d with argument env.
21 2. Call envRec.InitializeBinding(dn, fo).
23 includes: [fnGlobalObject.js]
27 var global = fnGlobalObject();
29 assert.sameValue(typeof test262, 'function', 'function value is hoisted');
30 assert.sameValue(test262(), 'test262', 'hoisted function value is correct');
32 Object.getOwnPropertyDescriptor(global, 'test262'), undefined
36 assert.sameValue(test262, null, 'binding is mutable');
38 Object.getOwnPropertyDescriptor(global, 'test262'), undefined
41 function test262() { return 'test262'; }
44 test262, null, 'binding is not effected by evaluation of declaration'
47 Object.getOwnPropertyDescriptor(global, 'test262'),
49 'global binding is not effected by evaluation of declaration'