instn-local-bndng-gen.js (1561B)
1 // |reftest| module 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. 4 /*--- 5 description: > 6 Mutable bindings are initialized in the lexical environment record prior to 7 execution for generator function declarations 8 esid: sec-moduledeclarationinstantiation 9 info: | 10 [...] 11 15. For each element d in varDeclarations do 12 a. For each element dn of the BoundNames of d do 13 i. If dn is not an element of declaredVarNames, then 14 1. Perform ! envRec.CreateMutableBinding(dn, false). 15 2. Call envRec.InitializeBinding(dn, undefined). 16 3. Append dn to declaredVarNames. 17 [...] 18 includes: [fnGlobalObject.js] 19 flags: [module] 20 ---*/ 21 22 var global = fnGlobalObject(); 23 24 assert.sameValue( 25 typeof test262, 'function', 'generator function value is hoisted' 26 ); 27 assert.sameValue( 28 test262().next().value, 29 'test262', 30 'hoisted generator function value is correct' 31 ); 32 assert.sameValue( 33 Object.getOwnPropertyDescriptor(global, 'test262'), undefined 34 ); 35 36 test262 = null; 37 assert.sameValue(test262, null, 'binding is mutable'); 38 assert.sameValue( 39 Object.getOwnPropertyDescriptor(global, 'test262'), undefined 40 ); 41 42 function* test262() { return 'test262'; } 43 44 assert.sameValue( 45 test262, null, 'binding is not effected by evaluation of declaration' 46 ); 47 assert.sameValue( 48 Object.getOwnPropertyDescriptor(global, 'test262'), 49 undefined, 50 'global binding is not effected by evaluation of declaration' 51 ); 52 53 reportCompare(0, 0);