Debian Codegraph @

js/src/tests/test262/language/eval-code/direct/var-env-var-init-local-exstng.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: Re-declaration of an existing local variable binding has no effect
6 info: |
7 [...]
8 16. For each String vn in declaredVarNames, in list order do
9 a. If varEnvRec is a global Environment Record, then
10 [...]
11 b. Else,
12 i. Let bindingExists be varEnvRec.HasBinding(vn).
13 ii. If bindingExists is false, then
14 [...]
15 [...]
16 flags: [noStrict]
17 ---*/
18
19 var initial;
20
21 (function() {
22 var x = 44443;
23 eval('initial = x; var x;');
24 }());
25
26 assert.sameValue(initial, 44443);
27 assert.throws(ReferenceError, function() {
28 x;
29 });
30
31 reportCompare(0, 0);