Debian Codegraph @

js/src/tests/test262/language/eval-code/indirect/var-env-var-init-global-exstng.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: 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 includes: [propertyHelper.js]
21 ---*/
22
23 var initial;
24 var x = 23;
25
26 (0, eval)('initial = x; var x = 45;');
27
28 verifyProperty(this, 'x', {
29 value: 45,
30 writable: true,
31 enumerable: true,
32 configurable: false,
33 });
34
35 assert.sameValue(initial, 23);
36
37 reportCompare(0, 0);