Debian Codegraph @

js/src/tests/test262/language/eval-code/indirect/var-env-var-init-global-new.js

raw
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 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 a. Perform ? ObjRec.CreateMutableBinding(N, D).
19 b. Perform ? ObjRec.InitializeBinding(N, undefined).
20 [...]
21 includes: [propertyHelper.js]
22 ---*/
23
24 var initial = null;
25
26 (0, eval)('initial = x; var x = 9;');
27
28 verifyProperty(this, 'x', {
29 value: 9,
30 writable: true,
31 enumerable: true,
32 configurable: true,
33 });
34
35 assert.sameValue(initial, undefined);
36
37 reportCompare(0, 0);