[gjs: 15/25] global: Use default global ClassOps
- From: Philip Chimento <pchimento src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gjs: 15/25] global: Use default global ClassOps
- Date: Sun, 26 Jan 2020 04:49:59 +0000 (UTC)
commit 2fe3a1bd6f8d7c355aba01844a731b274edc28ef
Author: Philip Chimento <philip chimento gmail com>
Date: Mon May 20 18:46:30 2019 -0700
global: Use default global ClassOps
This is a nice API improvement for global classes that don't do anything
weird.
gjs/global.cpp | 18 +-----------------
1 file changed, 1 insertion(+), 17 deletions(-)
---
diff --git a/gjs/global.cpp b/gjs/global.cpp
index 20a448bd..8415612a 100644
--- a/gjs/global.cpp
+++ b/gjs/global.cpp
@@ -209,25 +209,10 @@ gjs_printerr(JSContext *context,
}
class GjsGlobal {
- // clang-format off
- static constexpr JSClassOps class_ops = {
- nullptr, // addProperty
- nullptr, // deleteProperty
- nullptr, // enumerate
- JS_NewEnumerateStandardClasses,
- JS_ResolveStandardClass,
- JS_MayResolveStandardClass,
- nullptr, // finalize
- nullptr, // call
- nullptr, // hasInstance
- nullptr, // construct
- JS_GlobalObjectTraceHook};
- // clang-format on
-
static constexpr JSClass klass = {
"GjsGlobal",
JSCLASS_GLOBAL_FLAGS_WITH_SLOTS(GJS_GLOBAL_SLOT_LAST),
- &GjsGlobal::class_ops,
+ &JS::DefaultGlobalClassOps,
};
static constexpr JSFunctionSpec static_funcs[] = {
@@ -359,6 +344,5 @@ gjs_get_global_slot(JSContext *cx,
return JS_GetReservedSlot(global, JSCLASS_GLOBAL_SLOT_COUNT + slot);
}
-decltype(GjsGlobal::class_ops) constexpr GjsGlobal::class_ops;
decltype(GjsGlobal::klass) constexpr GjsGlobal::klass;
decltype(GjsGlobal::static_funcs) constexpr GjsGlobal::static_funcs;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]