[gjs: 5/15] object: Rename ObjectPrototype::new_for_js_object()



commit 2a387c0578e8352b56752ae7fb6f0d42e9a6867e
Author: Philip Chimento <philip chimento gmail com>
Date:   Sat Dec 8 21:43:54 2018 -0800

    object: Rename ObjectPrototype::new_for_js_object()
    
    The method is named incorrectly, since no JSObject is passed to it. We
    rename it to create().

 gi/object.cpp | 7 +++----
 gi/object.h   | 4 ++--
 2 files changed, 5 insertions(+), 6 deletions(-)
---
diff --git a/gi/object.cpp b/gi/object.cpp
index a8e3af21..fb46647c 100644
--- a/gi/object.cpp
+++ b/gi/object.cpp
@@ -1417,9 +1417,8 @@ ObjectInstance::ObjectInstance(JSContext* cx, JS::HandleObject object)
     debug_lifecycle("Instance constructor");
 }
 
-ObjectPrototype* ObjectPrototype::new_for_js_object(JSContext* cx,
-                                                    GIObjectInfo* info,
-                                                    GType gtype) {
+ObjectPrototype* ObjectPrototype::create(JSContext* cx, GIObjectInfo* info,
+                                         GType gtype) {
     auto* priv = g_slice_new0(ObjectPrototype);
     new (priv) ObjectPrototype(info, gtype);
     if (!priv->init(cx))
@@ -2239,7 +2238,7 @@ gjs_define_object_class(JSContext              *context,
                                GJS_MODULE_PROP_FLAGS))
         return false;
 
-    auto* priv = ObjectPrototype::new_for_js_object(context, info, gtype);
+    auto* priv = ObjectPrototype::create(context, info, gtype);
     if (!priv)
         return false;
     JS_SetPrivate(prototype, priv);
diff --git a/gi/object.h b/gi/object.h
index 6353c196..2977ec14 100644
--- a/gi/object.h
+++ b/gi/object.h
@@ -291,8 +291,8 @@ class ObjectPrototype : public ObjectBase {
  public:
     /* Public constructor for instances (uses GSlice allocator) */
     GJS_USE
-    static ObjectPrototype* new_for_js_object(JSContext* cx, GIObjectInfo* info,
-                                              GType gtype);
+    static ObjectPrototype* create(JSContext* cx, GIObjectInfo* info,
+                                   GType gtype);
 
     GJS_USE
     static ObjectPrototype* for_js(JSContext* cx, JS::HandleObject obj) {


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