GNOME Bugzilla – Bug 561573
Add non-default constructors and upcoming static methods to "class"
Last modified: 2008-11-19 21:57:12 UTC
We want to support things like Clutter.Texture.new_from_file. This change attaches them to the JavaScript constructor (which vaguely corresponds to the concept of a class in a sensible language). Implementation suggested by hp.
Created attachment 123061 [details] [review] Add non-default constructors and upcoming static methods to "class"
Created attachment 123063 [details] [review] Add non-default constructors and upcoming static methods to "class" We want to support things like Clutter.Texture.new_from_file. This change attaches them to the JavaScript constructor (which vaguely corresponds to the concept of a class in a sensible language). Implementation suggested by hp.
Comment on attachment 123063 [details] [review] Add non-default constructors and upcoming static methods to "class" I think gjs_debug() is trying to print the constructor before it's gotten. The first "get" of constructor is just trying to avoid registering the class a second time, so we return after that one. + if (constructor == NULL) { constructor can therefore never be null here unless we threw an exception, I think.
static JSBool gjs_define_static_methods(JSContext *context, JSObject *constructor_p, GIObjectInfo *object_info) constructor is not an out argument here I think, so maybe not _p (as opposed to gjs_define_object_class) obj_name = g_base_info_get_name ((GIBaseInfo*)object_info); (and a few others): no space before the parenthesis
Created attachment 123074 [details] [review] Add non-default constructors and upcoming static methods to "class" We want to support things like Clutter.Texture.new_from_file. This change attaches them to the JavaScript constructor (which vaguely corresponds to the concept of a class in a sensible language). Implementation suggested by hp.
Updated for review comments.
Thanks for the review!