Debian Codegraph @

js/src/tests/test262/language/eval-code/direct/var-env-lower-lex-non-strict.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: Variable collision with lexical binding in lower scope
6 info: |
7 [...]
8 5. If strict is false, then
9 [...]
10 d. Repeat while thisLex is not the same as varEnv,
11 i. Let thisEnvRec be thisLex's EnvironmentRecord.
12 ii. If thisEnvRec is not an object Environment Record, then
13 1. NOTE: The environment of with statements cannot contain any
14 lexical declaration so it doesn't need to be checked for
15 var/let hoisting conflicts.
16 2. For each name in varNames, do
17 a. If thisEnvRec.HasBinding(name) is true, then
18 i. Throw a SyntaxError exception.
19 b. NOTE: A direct eval will not hoist var declaration over a
20 like-named lexical declaration.
21 iii. Let thisLex be thisLex's outer environment reference.
22 [...]
23 flags: [noStrict]
24 features: [let]
25 ---*/
26
27 assert.throws(SyntaxError, function() {
28 {
29 let x;
30 {
31 eval('var x;');
32 }
33 }
34 });
35
36 reportCompare(0, 0);