After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 559705 - Missing association between static methods and classes
Missing association between static methods and classes
Status: RESOLVED FIXED
Product: gobject-introspection
Classification: Platform
Component: general
unspecified
Other All
: Normal normal
: ---
Assigned To: gobject-introspection Maintainer(s)
gobject-introspection Maintainer(s)
Depends on:
Blocks: 559704
 
 
Reported: 2008-11-07 07:22 UTC by Jürg Billeter
Modified: 2015-02-07 16:54 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
resolve static methods (11.33 KB, patch)
2008-11-17 04:18 UTC, Colin Walters
none Details | Review

Description Jürg Billeter 2008-11-07 07:22:10 UTC
Functions that are part of a class but do not take an instance parameter are currently added as namespace functions to the .gir. They should be moved to the appropriate class element to make the association easily accessible by all bindings. Examples for such functions are g_cancellable_get_current() and g_vfs_get_default().
Comment 1 Colin Walters 2008-11-07 23:15:57 UTC
This is a good idea; would need transformer, .gir and .typelib changes.

One highlevel question here is do we just take any function whose name matches a class prefix but doesn't take an intstance parameter as a static method, or do we need an annotation?  In other words do there exist functions that would be misidentified by this?
Comment 2 Colin Walters 2008-11-17 04:18:09 UTC
Created attachment 122832 [details] [review]
resolve static methods
Comment 3 Dan Winship 2008-11-17 20:12:49 UTC
(In reply to comment #1)
> One highlevel question here is do we just take any function whose name matches
> a class prefix but doesn't take an intstance parameter as a static method, or
> do we need an annotation?

gtk-sharp does the former, and it does the right thing 99% of the time; we might need an annotation to say "this ISN'T a static method" in the handful of cases it gets wrong.
Comment 4 Colin Walters 2008-11-17 21:09:08 UTC
Do you know if those cases would be candidates for IntrospectionSkip: (bug 556628) i.e. we don't need to bind them at all, or do we need a NotStatic: type annotation?
Comment 5 Dan Winship 2008-11-17 22:20:52 UTC
I can't remember any examples. We could just not have such an annotation until we find a case where it's necessary.
Comment 6 Johan (not receiving bugmail) Dahlin 2008-11-25 21:20:17 UTC
(In reply to comment #2)
> Created an attachment (id=122832) [edit]
> resolve static methods
> 

Looks good, I'll do some basic checks and commit if it works.
Comment 7 Jürg Billeter 2008-11-28 20:33:30 UTC
2008-11-25  Colin Walters  <walters@verbum.org>

        Bug 559705 – Missing association between static methods and classes

        * docs/typelib-format.txt:
        * girepository/ginfo.c (g_function_info_get_flags):
        * girepository/girmodule.c (g_ir_module_build_typelib):
        * girepository/girnode.c (g_ir_node_get_size),
        (g_ir_node_build_typelib):
        * girepository/girparser.c (start_function):
        * girepository/gtypelib.c (g_typelib_check_sanity),
        (validate_header), (validate_function_blob):
        * girepository/gtypelib.h:
        * giscanner/ast.py:
        * giscanner/girwriter.py:
        * giscanner/glibtransformer.py:
        * tests/scanner/foo-1.0-expected.gir:
        * tests/scanner/foo-1.0-expected.tgir:
        * tests/scanner/foo.h:

Fixed in r972.
Comment 8 André Klapper 2015-02-07 16:54:05 UTC
[Mass-moving gobject-introspection tickets to its own Bugzilla product - see bug 708029. Mass-filter your bugmail for this message: introspection20150207 ]