summaryrefslogtreecommitdiffstats
path: root/js/src/tests/test262/language/module-code/instn-iee-bndng-var.js
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 00:47:55 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 00:47:55 +0000
commit26a029d407be480d791972afb5975cf62c9360a6 (patch)
treef435a8308119effd964b339f76abb83a57c29483 /js/src/tests/test262/language/module-code/instn-iee-bndng-var.js
parentInitial commit. (diff)
downloadfirefox-26a029d407be480d791972afb5975cf62c9360a6.tar.xz
firefox-26a029d407be480d791972afb5975cf62c9360a6.zip
Adding upstream version 124.0.1.upstream/124.0.1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'js/src/tests/test262/language/module-code/instn-iee-bndng-var.js')
-rw-r--r--js/src/tests/test262/language/module-code/instn-iee-bndng-var.js65
1 files changed, 65 insertions, 0 deletions
diff --git a/js/src/tests/test262/language/module-code/instn-iee-bndng-var.js b/js/src/tests/test262/language/module-code/instn-iee-bndng-var.js
new file mode 100644
index 0000000000..de956a44e4
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/instn-iee-bndng-var.js
@@ -0,0 +1,65 @@
+// |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 indirectly-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]]).
+ [...]
+ 16. Let lexDeclarations be the LexicallyScopedDeclarations of code.
+ 17. For each element d in lexDeclarations do
+ a. For each element dn of the BoundNames of d do
+ i, If IsConstantDeclaration of d is true, then
+ [...]
+ ii. Else,
+ 1. Perform ! envRec.CreateMutableBinding(dn, false).
+ iii. If d is a GeneratorDeclaration production or a
+ FunctionDeclaration production, then
+ [...]
+
+ 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(
+ B,
+ undefined,
+ 'binding is initialized to `undefined` prior to module evaulation'
+);
+
+assert.throws(TypeError, function() {
+ B = null;
+}, 'binding rejects assignment');
+
+assert.sameValue(B, undefined, 'binding value is immutable');
+
+import { B, results } from './instn-iee-bndng-var_FIXTURE.js';
+export var A = 99;
+
+assert.sameValue(results.length, 4);
+assert.sameValue(results[0], 'ReferenceError');
+assert.sameValue(results[1], 'undefined');
+assert.sameValue(results[2], 'ReferenceError');
+assert.sameValue(results[3], 'undefined');
+
+
+reportCompare(0, 0);