script-decl-lex-restricted-global.js (1085B)
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: > 7 Let binding collision with non-configurable global property (not defined 8 through a declaration) 9 info: | 10 [...] 11 5. For each name in lexNames, do 12 a. If envRec.HasVarDeclaration(name) is true, throw a SyntaxError 13 exception. 14 b. If envRec.HasLexicalDeclaration(name) is true, throw a SyntaxError 15 exception. 16 c. Let hasRestrictedGlobal be ? envRec.HasRestrictedGlobalProperty(name). 17 d. If hasRestrictedGlobal is true, throw a SyntaxError exception. 18 ---*/ 19 20 Object.defineProperty(this, 'test262Configurable', { configurable: true }); 21 Object.defineProperty(this, 'test262NonConfigurable', { configurable: false }); 22 23 $262.evalScript('let test262Configurable;'); 24 25 assert.throws(SyntaxError, function() { 26 $262.evalScript('var x; let test262NonConfigurable;'); 27 }); 28 29 assert.throws(ReferenceError, function() { 30 x; 31 }); 32 33 reportCompare(0, 0);