aboutsummaryrefslogtreecommitdiff
path: root/src/javascript/jsc/bindings/ZigGlobalObject.h
diff options
context:
space:
mode:
authorGravatar Jarred Sumner <jarred@jarredsumner.com> 2021-07-21 02:07:07 -0700
committerGravatar Jarred Sumner <jarred@jarredsumner.com> 2021-07-21 02:07:07 -0700
commita8a4f280469d4d3baf8ea6e9dbce9ec06bd3d868 (patch)
tree8a10690daafe99a8d908119f9bb855cd0f3d368a /src/javascript/jsc/bindings/ZigGlobalObject.h
parentf2ea2027300949b919f9d595ce3039c8bc82d21a (diff)
downloadbun-a8a4f280469d4d3baf8ea6e9dbce9ec06bd3d868.tar.gz
bun-a8a4f280469d4d3baf8ea6e9dbce9ec06bd3d868.tar.zst
bun-a8a4f280469d4d3baf8ea6e9dbce9ec06bd3d868.zip
most of the bindings!
Diffstat (limited to 'src/javascript/jsc/bindings/ZigGlobalObject.h')
-rw-r--r--src/javascript/jsc/bindings/ZigGlobalObject.h65
1 files changed, 65 insertions, 0 deletions
diff --git a/src/javascript/jsc/bindings/ZigGlobalObject.h b/src/javascript/jsc/bindings/ZigGlobalObject.h
new file mode 100644
index 000000000..7436bc531
--- /dev/null
+++ b/src/javascript/jsc/bindings/ZigGlobalObject.h
@@ -0,0 +1,65 @@
+#pragma once
+
+namespace JSC {
+ class Structure;
+ class Identifier;
+
+}
+
+
+
+#include <JavaScriptCore/JSGlobalObject.h>
+
+
+
+
+namespace Zig {
+ using namespace JSC;
+
+class GlobalObject final : public JSGlobalObject {
+public:
+ using Base = JSGlobalObject;
+
+ DECLARE_EXPORT_INFO;
+ static const GlobalObjectMethodTable s_globalObjectMethodTable;
+
+ static constexpr bool needsDestruction = true;
+ template<typename CellType, SubspaceAccess mode>
+ static IsoSubspace* subspaceFor(VM& vm)
+ {
+ return vm.apiGlobalObjectSpace<mode>();
+ }
+
+ static GlobalObject* create(VM& vm, Structure* structure)
+ {
+ auto* object = new (NotNull, allocateCell<GlobalObject>(vm.heap)) GlobalObject(vm, structure);
+ object->finishCreation(vm);
+ return object;
+ }
+
+ static Structure* createStructure(VM& vm, JSValue prototype)
+ {
+ auto* result = Structure::create(vm, nullptr, prototype, TypeInfo(GlobalObjectType, StructureFlags), info());
+ result->setTransitionWatchpointIsLikelyToBeFired(true);
+ return result;
+ }
+
+ static void reportUncaughtExceptionAtEventLoop(JSGlobalObject*, Exception*);
+
+ static JSInternalPromise* moduleLoaderImportModule(JSGlobalObject*, JSModuleLoader*, JSString* moduleNameValue, JSValue parameters, const SourceOrigin&);
+ static Identifier moduleLoaderResolve(JSGlobalObject*, JSModuleLoader*, JSValue keyValue, JSValue referrerValue, JSValue);
+ static JSInternalPromise* moduleLoaderFetch(JSGlobalObject*, JSModuleLoader*, JSValue, JSValue, JSValue);
+ static JSObject* moduleLoaderCreateImportMetaProperties(JSGlobalObject*, JSModuleLoader*, JSValue, JSModuleRecord*, JSValue);
+ static JSValue moduleLoaderEvaluate(JSGlobalObject*, JSModuleLoader*, JSValue, JSValue, JSValue, JSValue, JSValue);
+
+
+private:
+ GlobalObject(VM& vm, Structure* structure)
+ : Base(vm, structure, &s_globalObjectMethodTable)
+ { }
+};
+
+}
+
+
+