var-env-var-init-local-new.js (1115B)
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: Initialization of new variable binding 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 [...] 11 b. Else, 12 i. Let bindingExists be varEnvRec.HasBinding(vn). 13 ii. If bindingExists is false, then 14 1. Let status be ! varEnvRec.CreateMutableBinding(vn, true). 15 2. Assert: status is not an abrupt completion because of 16 validation preceding step 12. 17 3. Perform ! varEnvRec.InitializeBinding(vn, undefined). 18 [...] 19 flags: [noStrict] 20 ---*/ 21 22 var initial = null; 23 var postAssignment; 24 25 (function() { 26 eval('initial = x; x = 4; postAssignment = x; var x;'); 27 }()); 28 29 assert.sameValue(initial, undefined); 30 assert.sameValue(postAssignment, 4, 'binding is mutable'); 31 assert.throws(ReferenceError, function() { 32 x; 33 }); 34 35 reportCompare(0, 0);