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.
6 Imported binding reflects state of indirectly-exported `const` binding
7 esid: sec-moduledeclarationinstantiation
10 12. For each ImportEntry Record in in module.[[ImportEntries]], do
11 a. Let importedModule be ? HostResolveImportedModule(module,
12 in.[[ModuleRequest]]).
13 b. If in.[[ImportName]] is "*", then
16 i. Let resolution be ?
17 importedModule.ResolveExport(in.[[ImportName]], « », « »).
18 ii. If resolution is null or resolution is "ambiguous", throw a
19 SyntaxError exception.
20 iii. Call envRec.CreateImportBinding(in.[[LocalName]],
21 resolution.[[Module]], resolution.[[BindingName]]).
23 16. Let lexDeclarations be the LexicallyScopedDeclarations of code.
24 17. For each element d in lexDeclarations do
25 a. For each element dn of the BoundNames of d do
26 i, If IsConstantDeclaration of d is true, then
27 1. Perform ! envRec.CreateImmutableBinding(dn, true).
29 1. Perform ! envRec.CreateMutableBinding(dn, false).
30 iii. If d is a GeneratorDeclaration production or a
31 FunctionDeclaration production, then
34 8.1.1.5.5 CreateImportBinding
37 5. Create an immutable indirect binding in envRec for N that references M
38 and N2 as its target binding and record that the binding is initialized.
39 6. Return NormalCompletion(empty).
43 assert.throws(ReferenceError, function() {
45 }, 'binding is created but not initialized');
47 import { B, results } from './instn-iee-bndng-const_FIXTURE.js';
48 export const A = null;
50 assert.sameValue(results.length, 4);
51 assert.sameValue(results[0], 'ReferenceError');
52 assert.sameValue(results[1], 'undefined');
53 assert.sameValue(results[2], 'ReferenceError');
54 assert.sameValue(results[3], 'undefined');