[gjs: 16/18] gtype: Remove gjs_typecheck_gtype()




commit 516d0eae6c946f93ac780fe09bf788cfdfbe80c7
Author: Philip Chimento <philip chimento gmail com>
Date:   Mon Nov 30 15:52:10 2020 -0800

    gtype: Remove gjs_typecheck_gtype()
    
    This function was only used in one place, and it was unnecessary because
    gjs_gtype_get_actual_gtype() is used on the same object later, which also
    checks the type. So, we can remove the function altogether.

 gi/gtype.cpp   | 8 --------
 gi/gtype.h     | 3 ---
 gi/private.cpp | 3 ---
 3 files changed, 14 deletions(-)
---
diff --git a/gi/gtype.cpp b/gi/gtype.cpp
index 7e08ec56..3797fbd0 100644
--- a/gi/gtype.cpp
+++ b/gi/gtype.cpp
@@ -177,11 +177,3 @@ bool gjs_gtype_get_actual_gtype(JSContext* context, JS::HandleObject object,
     const GjsAtoms& atoms = GjsContextPrivate::atoms(context);
     return _gjs_gtype_get_actual_gtype(context, atoms, object, gtype_out, 2);
 }
-
-bool
-gjs_typecheck_gtype (JSContext             *context,
-                     JS::HandleObject       obj,
-                     bool                   throw_error)
-{
-    return do_base_typecheck(context, obj, throw_error);
-}
diff --git a/gi/gtype.h b/gi/gtype.h
index b3369d6c..c7415fd2 100644
--- a/gi/gtype.h
+++ b/gi/gtype.h
@@ -22,7 +22,4 @@ GJS_JSAPI_RETURN_CONVENTION
 bool gjs_gtype_get_actual_gtype(JSContext* context, JS::HandleObject object,
                                 GType* gtype_out);
 
-[[nodiscard]] bool gjs_typecheck_gtype(JSContext* cx, JS::HandleObject obj,
-                                       bool throw_error);
-
 #endif  // GI_GTYPE_H_
diff --git a/gi/private.cpp b/gi/private.cpp
index f3c911d3..86300c6e 100644
--- a/gi/private.cpp
+++ b/gi/private.cpp
@@ -335,9 +335,6 @@ static bool gjs_signal_new(JSContext* cx, unsigned argc, JS::Value* vp) {
                              &params_obj))
         return false;
 
-    if (!gjs_typecheck_gtype(cx, gtype_obj, true))
-        return false;
-
     /* we only support standard accumulators for now */
     GSignalAccumulator accumulator;
     switch (accumulator_enum) {


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