GNOME Bugzilla – Bug 725061
Post-merge fixes for fundamental type support
Last modified: 2014-02-26 00:56:54 UTC
Should have been caught in review, especially because tests are failing.
Created attachment 270120 [details] [review] 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.
Created attachment 270121 [details] [review] arg: don't check manually for interface prerequisites g_type_is_a(interface, prerequisite) already does the expected thing, we don't need a slow manual check. Moreover, it's not documented, but add_prerequisite() always resolves a GTypeInterface type into the instantiable prerequisites, so g_type_interface_prerequisites() always returns instantiatable types.
Created attachment 270122 [details] [review] fundamental: assert that priv is not NULL if we are on the right JSClass We don't have custom inheritance for fundamental types, so we don't need to run JS code before the C object is constructed.
Created attachment 270123 [details] [review] arg: fix cast checking for objects and fundamentals We must make sure that all code paths successfully set the object or throw an exception.
Review of attachment 270120 [details] [review]: Ok.
Review of attachment 270121 [details] [review]: This may be totally fine... ::: gi/arg.cpp @@ +2692,3 @@ } else if (gtype == G_TYPE_NONE) { gjs_throw(context, "Unexpected unregistered type packing GArgument into jsval"); + } else if (G_TYPE_IS_INSTANTIATABLE(gtype) || G_TYPE_IS_INTERFACE(gtype)) { Just so I understand this - do we need || G_TYPE_IS_INTERFACE here? It looks like in the old code, we made them a GObject proxy (and djdeath preserved that) - now you're changing things so that non-gobject interfaces are fundamentals. Or hm...maybe I'm confused as to why the *old* code had: if (g_type_is_a(gtype, G_TYPE_OBJECT) || g_type_is_a(gtype, G_TYPE_INTERFACE)) Given that we only supported GObjects.
Review of attachment 270122 [details] [review]: Right.
Review of attachment 270123 [details] [review]: Makes sense to me.
Attachment 270120 [details] pushed as 38164a1 - Fix typecheck_is_object/is_fundamental Attachment 270121 [details] pushed as 58ab20d - arg: don't check manually for interface prerequisites Attachment 270122 [details] pushed as 9680de8 - fundamental: assert that priv is not NULL if we are on the right JSClass Attachment 270123 [details] pushed as 3d8bd0a - arg: fix cast checking for objects and fundamentals