block-decl-global-existing-global-init.js (1241B)
1 // This file was procedurally generated from the following sources: 2 // - src/annex-b-fns/global-existing-global-init.case 3 // - src/annex-b-fns/global/block.template 4 /*--- 5 description: Variable binding is left in place by legacy function hoisting. CreateGlobalVariableBinding leaves the binding as non-enumerable even if it has the chance to change it to be enumerable. (Block statement in the global scope containing a function declaration) 6 esid: sec-web-compat-globaldeclarationinstantiation 7 flags: [generated, noStrict] 8 includes: [fnGlobalObject.js, propertyHelper.js] 9 info: | 10 B.3.3.3 Changes to GlobalDeclarationInstantiation 11 12 [...] 13 Perform ? varEnvRec.CreateGlobalVarBinding(F, true). 14 [...] 15 16 ---*/ 17 var global = fnGlobalObject(); 18 Object.defineProperty(global, 'f', { 19 value: 'x', 20 enumerable: true, 21 writable: true, 22 configurable: false 23 }); 24 25 $262.evalScript(` 26 assert.sameValue(f, 'x'); 27 verifyProperty(global, 'f', { 28 enumerable: true, 29 writable: true, 30 configurable: false 31 }, { restore: true }); 32 `); 33 34 $262.evalScript(` 35 36 { 37 function f() { return 'inner declaration'; } 38 } 39 40 `); 41 42 $262.evalScript(` 43 verifyProperty(global, 'f', { 44 enumerable: true, 45 writable: true, 46 configurable: false 47 }); 48 `); 49 50 reportCompare(0, 0);