instn-local-bndng-let.js (1284B)
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 created in the lexical environment record prior to 7 execution for `let` declarations 8 esid: sec-moduledeclarationinstantiation 9 info: | 10 [...] 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 14 [...] 15 ii. Else, 16 1. Perform ! envRec.CreateMutableBinding(dn, false). 17 [...] 18 includes: [fnGlobalObject.js] 19 flags: [module] 20 ---*/ 21 22 var global = fnGlobalObject(); 23 24 assert.throws(ReferenceError, function() { 25 typeof test262; 26 }, 'Binding is created but not initialized.'); 27 assert.sameValue( 28 Object.getOwnPropertyDescriptor(global, 'test262'), undefined 29 ); 30 31 let test262; 32 33 assert.sameValue(test262, undefined); 34 assert.sameValue( 35 Object.getOwnPropertyDescriptor(global, 'test262'), undefined 36 ); 37 38 test262 = null; 39 40 assert.sameValue(test262, null, 'binding is mutable'); 41 assert.sameValue( 42 Object.getOwnPropertyDescriptor(global, 'test262'), 43 undefined, 44 'global binding is not effected by modification' 45 ); 46 47 reportCompare(0, 0);