Debian Codegraph @

js/src/tests/test262/language/eval-code/direct/var-env-var-init-local-new-delete.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: Newly-created local binding may be deleted
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 1. Let status be ! varEnvRec.CreateMutableBinding(vn, true).
15 2. Assert: status is not an abrupt completion because of
16 validation preceding step 12.
17 3. Perform ! varEnvRec.InitializeBinding(vn, undefined).
18 [...]
19 flags: [noStrict]
20 ---*/
21
22 var initial = null;
23 var postDeletion;
24
25 (function() {
26 eval('initial = x; delete x; postDeletion = function() { x; }; var x;');
27 }());
28
29 assert.sameValue(initial, undefined);
30 assert.throws(ReferenceError, postDeletion);
31
32 reportCompare(0, 0);