Bug 1909121 - [wpt-sync] Update web-platform-tests to 5af3e9c2a2aba76ade00f0dbc3486e5...
[gecko.git] / js / src / vm / Modules.h
blobd59c9db55217a8df82f18ece754c9be49c9fba50
1 /* -*- Mode: javascript; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4
2 * -*- */
3 /* This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
7 #ifndef vm_Modules_h
8 #define vm_Modules_h
10 #include "NamespaceImports.h"
12 #include "builtin/ModuleObject.h"
13 #include "js/AllocPolicy.h"
14 #include "js/GCVector.h"
15 #include "js/RootingAPI.h"
17 struct JSContext;
19 namespace js {
21 using ModuleVector = GCVector<ModuleObject*, 0, SystemAllocPolicy>;
23 // A struct with detailed error information when import/export failed.
24 struct ModuleErrorInfo {
25 ModuleErrorInfo(uint32_t lineNumber_, JS::ColumnNumberOneOrigin columnNumber_)
26 : lineNumber(lineNumber_), columnNumber(columnNumber_) {}
28 void setImportedModule(JSContext* cx, ModuleObject* importedModule);
29 void setCircularImport(JSContext* cx, ModuleObject* importedModule);
30 void setForAmbiguousImport(JSContext* cx, ModuleObject* importedModule,
31 ModuleObject* module1, ModuleObject* module2);
33 uint32_t lineNumber;
34 JS::ColumnNumberOneOrigin columnNumber;
36 // The filename of the imported module.
37 const char* imported;
39 // The filenames of the ambiguous entries.
40 const char* entry1;
41 const char* entry2;
43 // A bool to indicate the error is a circular import when it's true.
44 bool isCircular = false;
47 ModuleNamespaceObject* GetOrCreateModuleNamespace(JSContext* cx,
48 Handle<ModuleObject*> module);
50 void AsyncModuleExecutionFulfilled(JSContext* cx, Handle<ModuleObject*> module);
52 void AsyncModuleExecutionRejected(JSContext* cx, Handle<ModuleObject*> module,
53 HandleValue error);
55 } // namespace js
57 #endif // vm_Modules_h