[gjs] Fix typecheck_is_object/is_fundamental



commit 38164a1273e889519b4a5fdcfbdd091541846758
Author: Giovanni Campagna <gcampagna src gnome org>
Date:   Mon Feb 24 13:41:20 2014 +0100

    Fix typecheck_is_object/is_fundamental
    
    We don't need to check if priv == NULL, the purpose of those
    calls is only to check the JSClass. Additionally, we don't
    need to throw an exception, do_base_typecheck() already does.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=725061

 gi/fundamental.cpp |   13 +------------
 gi/object.cpp      |   14 +-------------
 2 files changed, 2 insertions(+), 25 deletions(-)
---
diff --git a/gi/fundamental.cpp b/gi/fundamental.cpp
index 442514e..a3c3a2f 100644
--- a/gi/fundamental.cpp
+++ b/gi/fundamental.cpp
@@ -880,18 +880,7 @@ gjs_typecheck_is_fundamental(JSContext     *context,
                              JSObject      *object,
                              JSBool         throw_error)
 {
-    if (do_base_typecheck(context, object, throw_error)) {
-        FundamentalInstance *priv = priv_from_js(context, object);
-
-        if (priv)
-            return JS_TRUE;
-    }
-
-    if (throw_error)
-        gjs_throw(context,
-                  "Object instance or prototype is not a fundamental");
-
-    return JS_FALSE;
+    return do_base_typecheck(context, object, throw_error);
 }
 
 JSBool
diff --git a/gi/object.cpp b/gi/object.cpp
index 2745833..5809e08 100644
--- a/gi/object.cpp
+++ b/gi/object.cpp
@@ -2038,19 +2038,7 @@ gjs_typecheck_is_object(JSContext     *context,
                         JSObject      *object,
                         JSBool         throw_error)
 {
-
-    if (do_base_typecheck(context, object, throw_error)) {
-        ObjectInstance *priv = priv_from_js(context, object);
-
-        if (priv)
-            return JS_TRUE;
-    }
-
-    if (throw_error)
-        gjs_throw(context,
-                  "Object instance or prototype is not a GObject");
-
-    return JS_FALSE;
+    return do_base_typecheck(context, object, throw_error);
 }
 
 JSBool


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