2016-07-20 03:02:05 +02:00
|
|
|
// Copyright (C) 2016 the V8 project authors. All rights reserved.
|
|
|
|
// This code is governed by the BSD license found in the LICENSE file.
|
|
|
|
/*---
|
|
|
|
esid: sec-globaldeclarationinstantiation
|
|
|
|
es6id: 15.1.8
|
|
|
|
description: Let binding collision with existing var declaration
|
|
|
|
info: |
|
|
|
|
[...]
|
|
|
|
5. For each name in lexNames, do
|
|
|
|
a. If envRec.HasVarDeclaration(name) is true, throw a SyntaxError
|
|
|
|
exception.
|
|
|
|
---*/
|
|
|
|
|
|
|
|
var test262Var;
|
|
|
|
function test262Fn() {}
|
|
|
|
|
|
|
|
assert.throws(SyntaxError, function() {
|
2017-03-01 22:34:15 +01:00
|
|
|
$262.evalScript('var x; let test262Var;');
|
2016-07-20 03:02:05 +02:00
|
|
|
}, 'variable');
|
|
|
|
|
|
|
|
assert.throws(ReferenceError, function() {
|
|
|
|
x;
|
|
|
|
}, 'no bindings created (script shadowing variable)');
|
|
|
|
|
|
|
|
assert.throws(SyntaxError, function() {
|
2017-03-01 22:34:15 +01:00
|
|
|
$262.evalScript('var x; let test262Fn;');
|
2016-07-20 03:02:05 +02:00
|
|
|
}, 'function');
|
|
|
|
|
|
|
|
assert.throws(ReferenceError, function() {
|
|
|
|
x;
|
|
|
|
}, 'no bindings created (script shadowing function)');
|