[gjs: 3/10] boxed: Remove zero_args_constructor_name member



commit 0decc66cb5bc089ff6d1c79536d8480b1d20b3d8
Author: Philip Chimento <philip chimento gmail com>
Date:   Wed Dec 26 15:31:27 2018 -0700

    boxed: Remove zero_args_constructor_name member
    
    This was not actually used anywhere, as the zero-args constructor is
    invoked directly with g_function_info_invoke().

 gi/boxed.cpp | 10 ++++------
 gi/boxed.h   |  1 -
 2 files changed, 4 insertions(+), 7 deletions(-)
---
diff --git a/gi/boxed.cpp b/gi/boxed.cpp
index 287a6204..51ef8783 100644
--- a/gi/boxed.cpp
+++ b/gi/boxed.cpp
@@ -704,8 +704,6 @@ bool BoxedPrototype::define_boxed_class_fields(JSContext* cx,
 
 // Overrides GIWrapperPrototype::trace_impl().
 void BoxedPrototype::trace_impl(JSTracer* trc) {
-    JS::TraceEdge<jsid>(trc, &m_zero_args_constructor_name,
-                        "Boxed::zero_args_constructor_name");
     JS::TraceEdge<jsid>(trc, &m_default_constructor_name,
                         "Boxed::default_constructor_name");
     if (m_field_map)
@@ -861,7 +859,6 @@ struct_is_simple(GIStructInfo *info)
 BoxedPrototype::BoxedPrototype(GIStructInfo* info, GType gtype)
     : GIWrapperPrototype(info, gtype),
       m_zero_args_constructor(-1),
-      m_zero_args_constructor_name(JSID_VOID),
       m_default_constructor(-1),
       m_default_constructor_name(JSID_VOID),
       m_can_allocate_directly(struct_is_simple(info)) {
@@ -873,6 +870,7 @@ bool BoxedPrototype::init(JSContext* context) {
     int i, n_methods;
     int first_constructor = -1;
     jsid first_constructor_name = JSID_VOID;
+    jsid zero_args_constructor_name = JSID_VOID;
 
     if (m_gtype != G_TYPE_NONE) {
         /* If the structure is registered as a boxed, we can create a new instance by
@@ -900,9 +898,9 @@ bool BoxedPrototype::init(JSContext* context) {
                 if (m_zero_args_constructor < 0 &&
                     g_callable_info_get_n_args(func_info) == 0) {
                     m_zero_args_constructor = i;
-                    m_zero_args_constructor_name =
+                    zero_args_constructor_name =
                         gjs_intern_string_to_id(context, func_info.name());
-                    if (m_zero_args_constructor_name == JSID_VOID)
+                    if (zero_args_constructor_name == JSID_VOID)
                         return false;
                 }
 
@@ -917,7 +915,7 @@ bool BoxedPrototype::init(JSContext* context) {
 
         if (m_default_constructor < 0) {
             m_default_constructor = m_zero_args_constructor;
-            m_default_constructor_name = m_zero_args_constructor_name;
+            m_default_constructor_name = zero_args_constructor_name;
         }
         if (m_default_constructor < 0) {
             m_default_constructor = first_constructor;
diff --git a/gi/boxed.h b/gi/boxed.h
index 299ebef3..5b2c348b 100644
--- a/gi/boxed.h
+++ b/gi/boxed.h
@@ -97,7 +97,6 @@ class BoxedPrototype : public GIWrapperPrototype<BoxedBase, BoxedPrototype,
                       js::DefaultHasher<JSString*>, js::SystemAllocPolicy>;
 
     int m_zero_args_constructor;  // -1 if none
-    JS::Heap<jsid> m_zero_args_constructor_name;
     int m_default_constructor;  // -1 if none
     JS::Heap<jsid> m_default_constructor_name;
     FieldMap* m_field_map;


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]