var-env-var-init-global-exstng.js (935B)
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: Declaration does not modify existing global property 6 info: | 7 [...] 8 16. For each String vn in declaredVarNames, in list order do 9 a. If varEnvRec is a global Environment Record, then 10 i. Perform ? varEnvRec.CreateGlobalVarBinding(vn, true). 11 [...] 12 13 8.1.1.4.17 CreateGlobalVarBinding 14 15 [...] 16 5. Let extensible be ? IsExtensible(globalObject). 17 6. If hasProperty is false and extensible is true, then 18 [...] 19 [...] 20 flags: [noStrict] 21 includes: [propertyHelper.js] 22 ---*/ 23 24 var initial; 25 var x = 23; 26 27 eval('initial = x; var x = 45;'); 28 29 verifyProperty(this, 'x', { 30 value: 45, 31 writable: true, 32 enumerable: true, 33 configurable: false, 34 }); 35 36 assert.sameValue(initial, 23); 37 38 reportCompare(0, 0);