Debian Codegraph @

js/src/tests/test262/language/global-code/decl-lex-configurable-global.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-globaldeclarationinstantiation
5 es6id: 15.1.8
6 description: Lexical declarations "shadow" configurable global properties
7 info: |
8 [...]
9 5. For each name in lexNames, do
10 [...]
11 c. Let hasRestrictedGlobal be ? envRec.HasRestrictedGlobalProperty(name).
12 d. If hasRestrictedGlobal is true, throw a SyntaxError exception.
13 [...]
14 16. For each element d in lexDeclarations do
15 a. NOTE Lexically declared names are only instantiated here but not
16 initialized.
17 b. For each element dn of the BoundNames of d do
18 i. If IsConstantDeclaration of d is true, then
19 1. Perform ? envRec.CreateImmutableBinding(dn, true).
20 ii. Else,
21 1. Perform ? envRec.CreateMutableBinding(dn, false).
22 ---*/
23
24 let Array;
25
26 assert.sameValue(Array, undefined);
27 assert.sameValue(typeof this.Array, 'function');
28
29 // DO NOT USE propertyHelper API!
30 let descriptor = Object.getOwnPropertyDescriptor(this, 'Array');
31 assert.sameValue(descriptor.configurable, true);
32 assert.sameValue(descriptor.enumerable, false);
33 assert.sameValue(descriptor.writable, true);
34
35 reportCompare(0, 0);