[gjs: 8/13] object: Rename field_setter_impl()



commit f653610a62509c1413052f0e810872ef6ee5c2ef
Author: Philip Chimento <philip chimento gmail com>
Date:   Sat Mar 30 17:02:01 2019 -0700

    object: Rename field_setter_impl()
    
    ObjectInstance::field_setter_impl() does not actually set any GObject
    instance fields, because those are never exposed as writable in
    gobject-introspection.
    
    Therefore, we rename it to field_setter_not_impl() for clarity, and
    remove the unused argument specifying the value to set the field to.

 gi/object.cpp | 12 ++++++------
 gi/object.h   |  3 +--
 2 files changed, 7 insertions(+), 8 deletions(-)
---
diff --git a/gi/object.cpp b/gi/object.cpp
index 6946902f..8272c569 100644
--- a/gi/object.cpp
+++ b/gi/object.cpp
@@ -504,11 +504,11 @@ bool ObjectBase::field_setter(JSContext* cx, unsigned argc, JS::Value* vp) {
      * the field */
     args.rval().setUndefined();
 
-    return priv->to_instance()->field_setter_impl(cx, name, args[0]);
+    return priv->to_instance()->field_setter_not_impl(cx, name);
 }
 
-bool ObjectInstance::field_setter_impl(JSContext* cx, JS::HandleString name,
-                                       JS::HandleValue value) {
+bool ObjectInstance::field_setter_not_impl(JSContext* cx,
+                                           JS::HandleString name) {
     if (!check_gobject_disposed("set GObject field on"))
         return true;
 
@@ -1677,9 +1677,9 @@ gjs_lookup_object_prototype(JSContext *context,
 }
 
 // Retrieves a GIFieldInfo for a field named @key. This is for use in
-// field_getter_impl() and field_setter_impl(), where the field info *must* have
-// been cached previously in resolve_impl() on this ObjectPrototype or one of
-// its parent ObjectPrototypes. This will fail an assertion if there is no
+// field_getter_impl() and field_setter_not_impl(), where the field info *must*
+// have been cached previously in resolve_impl() on this ObjectPrototype or one
+// of its parent ObjectPrototypes. This will fail an assertion if there is no
 // cached field info.
 //
 // The caller does not own the return value, and it can never be null.
diff --git a/gi/object.h b/gi/object.h
index b7a4995c..0c81d2e6 100644
--- a/gi/object.h
+++ b/gi/object.h
@@ -414,8 +414,7 @@ class ObjectInstance : public GIWrapperInstance<ObjectBase, ObjectPrototype,
     bool prop_setter_impl(JSContext* cx, JS::HandleString name,
                           JS::HandleValue value);
     GJS_JSAPI_RETURN_CONVENTION
-    bool field_setter_impl(JSContext* cx, JS::HandleString name,
-                           JS::HandleValue value);
+    bool field_setter_not_impl(JSContext* cx, JS::HandleString name);
 
     // JS constructor
 


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