MCPcopy Create free account
hub / github.com/GNOME/gjs / gjs_internal_compile_module

Function gjs_internal_compile_module

gjs/internal.cpp:221–233  ·  view source on GitHub ↗

* gjs_internal_compile_module: * @uri: The URI of the module (JS string) * @source: The source text of the module (JS string) * * JS function exposed as `compileModule` in the internal global scope. * * Compiles a module source text within the main realm. * * NOTE: Modules compiled with this function can only be executed * within the main realm. * * Returns: The compiled JS module objec

Source from the content-addressed store, hash-verified

219 * Returns: The compiled JS module object.
220 */
221bool gjs_internal_compile_module(JSContext* cx, unsigned argc, JS::Value* vp) {
222 JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
223
224 Gjs::AutoMainRealm ar{cx};
225
226 JS::UniqueChars uri;
227 JS::RootedString source(cx);
228 if (!gjs_parse_call_args(cx, "compileModule", args, "sS", "uri", &uri,
229 "source", &source))
230 return handle_wrong_args(cx);
231
232 return compile_module(cx, uri, source, args.rval());
233}
234
235/**
236 * gjs_internal_set_module_private:

Callers

nothing calls this directly

Calls 3

gjs_parse_call_argsFunction · 0.85
handle_wrong_argsFunction · 0.85
compile_moduleFunction · 0.85

Tested by

no test coverage detected