Debian Codegraph @

js/src/tests/test262/language/module-code/eval-gtbndng-local-bndng-var.js

raw
1 // |reftest| module
2 // Copyright (C) 2016 the V8 project authors. All rights reserved.
3 // This code is governed by the BSD license found in the LICENSE file.
4 /*---
5 description: References to local `var` bindings resolve successfully
6 esid: sec-moduleevaluation
7 info: |
8 8.1.1.5.1 GetBindingValue (N, S)
9
10 [...]
11 3. If the binding for N is an indirect binding, then
12 [...]
13 5. Return the value currently bound to N in envRec.
14
15
16 15.2.1.16.4 ModuleDeclarationInstantiation( )
17
18 [...]
19 14. Let declaredVarNames be a new empty List.
20 15. For each element d in varDeclarations do
21 a. For each element dn of the BoundNames of d do
22 i. If dn is not an element of declaredVarNames, then
23 1. Perform ! envRec.CreateMutableBinding(dn, false).
24 2. Call envRec.InitializeBinding(dn, undefined).
25 3. Append dn to declaredVarNames.
26 [...]
27
28 13.3.2.4 Runtime Semantics: Evaluation
29
30 VariableDeclaration : BindingIdentifier Initializer
31
32 [...]
33 6. Return ? PutValue(lhs, value).
34 flags: [module]
35 ---*/
36
37 var varBinding = 1;
38 assert.sameValue(varBinding, 1);
39
40 varBinding = 2;
41 assert.sameValue(varBinding, 2);
42
43 reportCompare(0, 0);