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.
4 esid: sec-globaldeclarationinstantiation
6 description: Declaration of lexical bindings
9 16. For each element d in lexDeclarations do
10 a. NOTE Lexically declared names are only instantiated here but not
12 b. For each element dn of the BoundNames of d do
13 i. If IsConstantDeclaration of d is true, then
14 1. Perform ? envRec.CreateImmutableBinding(dn, true).
16 1. Perform ? envRec.CreateMutableBinding(dn, false).
20 // Extensibility of the global object should have no bearing on lexical
22 Object.preventExtensions(this);
24 $262.evalScript('let test262let = 1;');
28 assert.sameValue(test262let, 2, '`let` binding is mutable');
30 this.hasOwnProperty('test262let'),
32 'property not created on the global object (let)'
35 $262.evalScript('const test262const = 3;');
37 assert.throws(TypeError, function() {
39 }, '`const` binding is strictly immutable');
40 assert.sameValue(test262const, 3, '`const` binding cannot be modified');
42 this.hasOwnProperty('test262const'),
44 'property not created on the global object (const)'
47 $262.evalScript('class test262class {}');
51 assert.sameValue(test262class, 5, '`class` binding is mutable');
53 this.hasOwnProperty('test262class'),
55 'property not created on the global object (class)'