diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-28 14:29:10 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-28 14:29:10 +0000 |
commit | 2aa4a82499d4becd2284cdb482213d541b8804dd (patch) | |
tree | b80bf8bf13c3766139fbacc530efd0dd9d54394c /js/src/tests/test262/language/module-code/instn-named-bndng-var.js | |
parent | Initial commit. (diff) | |
download | firefox-2aa4a82499d4becd2284cdb482213d541b8804dd.tar.xz firefox-2aa4a82499d4becd2284cdb482213d541b8804dd.zip |
Adding upstream version 86.0.1.upstream/86.0.1upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'js/src/tests/test262/language/module-code/instn-named-bndng-var.js')
-rw-r--r-- | js/src/tests/test262/language/module-code/instn-named-bndng-var.js | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/js/src/tests/test262/language/module-code/instn-named-bndng-var.js b/js/src/tests/test262/language/module-code/instn-named-bndng-var.js new file mode 100644 index 0000000000..0926ee998c --- /dev/null +++ b/js/src/tests/test262/language/module-code/instn-named-bndng-var.js @@ -0,0 +1,55 @@ +// |reftest| module +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: Imported binding reflects state of exported `var` binding +esid: sec-moduledeclarationinstantiation +info: | + [...] + 12. For each ImportEntry Record in in module.[[ImportEntries]], do + a. Let importedModule be ? HostResolveImportedModule(module, + in.[[ModuleRequest]]). + b. If in.[[ImportName]] is "*", then + [...] + c. Else, + i. Let resolution be ? + importedModule.ResolveExport(in.[[ImportName]], « », « »). + ii. If resolution is null or resolution is "ambiguous", throw a + SyntaxError exception. + iii. Call envRec.CreateImportBinding(in.[[LocalName]], + resolution.[[Module]], resolution.[[BindingName]]). + [...] + 14. Let declaredVarNames be a new empty List. + 15. For each element d in varDeclarations do + a. For each element dn of the BoundNames of d do + i. If dn is not an element of declaredVarNames, then + 1. Perform ! envRec.CreateMutableBinding(dn, false). + 2. Call envRec.InitializeBinding(dn, undefined). + 3. Append dn to declaredVarNames. + [...] + + 8.1.1.5.5 CreateImportBinding + + [...] + 5. Create an immutable indirect binding in envRec for N that references M + and N2 as its target binding and record that the binding is initialized. + 6. Return NormalCompletion(empty). +flags: [module] +---*/ + +assert.sameValue( + y, + undefined, + 'binding is initialized to `undefined` prior to module evaulation' +); + +assert.throws(TypeError, function() { + y = null; +}, 'binding rejects assignment'); + +assert.sameValue(y, undefined, 'binding value is immutable'); + +import { x as y } from './instn-named-bndng-var.js'; +export var x = 23; + +reportCompare(0, 0); |