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.
5 description: Imported binding reflects state of exported `const` binding
6 esid: sec-moduledeclarationinstantiation
9 12. For each ImportEntry Record in in module.[[ImportEntries]], do
10 a. Let importedModule be ? HostResolveImportedModule(module,
11 in.[[ModuleRequest]]).
12 b. If in.[[ImportName]] is "*", then
15 i. Let resolution be ?
16 importedModule.ResolveExport(in.[[ImportName]], « », « »).
17 ii. If resolution is null or resolution is "ambiguous", throw a
18 SyntaxError exception.
19 iii. Call envRec.CreateImportBinding(in.[[LocalName]],
20 resolution.[[Module]], resolution.[[BindingName]]).
22 16. Let lexDeclarations be the LexicallyScopedDeclarations of code.
23 17. For each element d in lexDeclarations do
24 a. For each element dn of the BoundNames of d do
25 i, If IsConstantDeclaration of d is true, then
26 1. Perform ! envRec.CreateImmutableBinding(dn, true).
28 1. Perform ! envRec.CreateMutableBinding(dn, false).
29 iii. If d is a GeneratorDeclaration production or a
30 FunctionDeclaration production, then
33 8.1.1.5.5 CreateImportBinding
36 5. Create an immutable indirect binding in envRec for N that references M
37 and N2 as its target binding and record that the binding is initialized.
38 6. Return NormalCompletion(empty).
42 assert.throws(ReferenceError, function() {
44 }, 'binding is created but not initialized');
46 import { x as y } from './instn-named-bndng-let.js';