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: Modules have distinct environment records
6 esid: sec-moduledeclarationinstantiation
9 6. Let env be NewModuleEnvironment(realm.[[GlobalEnv]]).
10 7. Set module.[[Environment]] to env.
13 8.1.2.6 NewModuleEnvironment (E)
15 1. Let env be a new Lexical Environment.
18 features: [generators]
21 import './instn-uniq-env-rec-other_FIXTURE.js'
26 function fifth() { return 'fifth'; }
27 function* sixth() { return 'sixth'; }
29 assert.sameValue(first, 1);
30 assert.sameValue(second, 2);
31 assert.sameValue(third, 3);
32 assert.sameValue(typeof fourth, 'function', 'class declaration');
33 assert.sameValue(typeof fifth, 'function', 'function declaration');
34 assert.sameValue(fifth(), 'fifth');
35 assert.sameValue(typeof sixth, 'function', 'generator function declaration');
36 assert.sameValue(sixth().next().value, 'sixth');
38 // Two separate mechanisms are required to ensure that no binding has been
39 // created for a given identifier. A "bare" reference should produce a
40 // ReferenceError for non-existent bindings and uninitialized bindings. A
41 // reference through the `typeof` operator should succeed for non-existent
42 // bindings and initialized bindings. Only non-existent bindings satisfy both
45 assert.throws(ReferenceError, function() {
50 assert.throws(ReferenceError, function() {
55 assert.throws(ReferenceError, function() {
60 assert.throws(ReferenceError, function() {
65 assert.throws(ReferenceError, function() {
70 assert.throws(ReferenceError, function() {