instn-star-binding.js (1105B)
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: Immutable binding is created for module namespace object 6 esid: sec-moduledeclarationinstantiation 7 info: | 8 [...] 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 13 i. Let namespace be ? GetModuleNamespace(importedModule). 14 ii. Perform ! envRec.CreateImmutableBinding(in.[[LocalName]], true). 15 iii. Call envRec.InitializeBinding(in.[[LocalName]], namespace). 16 [...] 17 flags: [module] 18 ---*/ 19 20 assert.sameValue( 21 typeof ns, 'object', 'binding is initialized prior to module evaluation' 22 ); 23 24 var original = ns; 25 26 assert.throws(TypeError, function() { 27 ns = null; 28 }, 'binding rejects assignment'); 29 30 assert.sameValue(ns, original, 'binding value is immutable'); 31 32 import * as ns from './instn-star-binding.js'; 33 34 reportCompare(0, 0);