diff options
author | Colin Walters <walters@verbum.org> | 2008-11-25 22:29:20 (GMT) |
---|---|---|
committer | Johan Dahlin <johan@src.gnome.org> | 2008-11-25 22:29:20 (GMT) |
commit | 792c394d3b0350652291f2f93f9d769c3a03024e (patch) | |
tree | ca01bd0a4ad24825e7470f8a5e187a5d82844f7b /girepository | |
parent | 620a59eec01141746f560a3b37357b838a47177a (diff) |
Bug 559705 – Missing association between static methods and classes
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:
svn path=/trunk/; revision=972
Diffstat (limited to 'girepository')
-rw-r--r-- | girepository/ginfo.c | 2 | ||||
-rw-r--r-- | girepository/girmodule.c | 2 | ||||
-rw-r--r-- | girepository/girnode.c | 3 | ||||
-rw-r--r-- | girepository/girparser.c | 4 | ||||
-rw-r--r-- | girepository/gtypelib.c | 6 | ||||
-rw-r--r-- | girepository/gtypelib.h | 7 |
6 files changed, 17 insertions, 7 deletions
diff --git a/girepository/ginfo.c b/girepository/ginfo.c index 0e39bcd..5df1e3f 100644 --- a/girepository/ginfo.c +++ b/girepository/ginfo.c @@ -494,7 +494,7 @@ g_function_info_get_flags (GIFunctionInfo *info) flags = 0; /* Make sure we don't flag Constructors as methods */ - if (base->container != NULL && !blob->constructor) + if (!blob->constructor && !blob->is_static) flags = flags | GI_FUNCTION_IS_METHOD; if (blob->constructor) diff --git a/girepository/girmodule.c b/girepository/girmodule.c index 1b26f3d..be41a1e 100644 --- a/girepository/girmodule.c +++ b/girepository/girmodule.c @@ -209,7 +209,7 @@ g_ir_module_build_typelib (GIrModule *module, : 0); header->directory = ALIGN_VALUE (header_size, 4); header->entry_blob_size = 12; - header->function_blob_size = 16; + header->function_blob_size = sizeof (FunctionBlob); header->callback_blob_size = 12; header->signal_blob_size = 12; header->vfunc_blob_size = 16; diff --git a/girepository/girnode.c b/girepository/girnode.c index 75dd265..61e4f0b 100644 --- a/girepository/girnode.c +++ b/girepository/girnode.c @@ -415,7 +415,7 @@ g_ir_node_get_size (GIrNode *node) break; case G_IR_NODE_FUNCTION: - size = 16; + size = sizeof (FunctionBlob); break; case G_IR_NODE_PARAM: @@ -1581,6 +1581,7 @@ g_ir_node_build_typelib (GIrNode *node, blob->blob_type = BLOB_TYPE_FUNCTION; blob->deprecated = function->deprecated; + blob->is_static = !function->is_method; blob->setter = function->is_setter; blob->getter = function->is_getter; blob->constructor = function->is_constructor; diff --git a/girepository/girparser.c b/girepository/girparser.c index 48e3119..e6d59b4 100644 --- a/girepository/girparser.c +++ b/girepository/girparser.c @@ -674,10 +674,12 @@ start_function (GMarkupParseContext *context, strcmp (element_name, "callback") == 0); break; case STATE_CLASS: + found = strcmp (element_name, "function") == 0; + /* fallthrough */ case STATE_BOXED: case STATE_STRUCT: case STATE_UNION: - found = strcmp (element_name, "constructor") == 0; + found = (found || strcmp (element_name, "constructor") == 0); /* fallthrough */ case STATE_INTERFACE: found = (found || diff --git a/girepository/gtypelib.c b/girepository/gtypelib.c index 5cda705..51cbafc 100644 --- a/girepository/gtypelib.c +++ b/girepository/gtypelib.c @@ -167,7 +167,7 @@ g_typelib_check_sanity (void) CHECK_SIZE (ArgBlob, 12); CHECK_SIZE (SignatureBlob, 8); CHECK_SIZE (CommonBlob, 8); - CHECK_SIZE (FunctionBlob, 16); + CHECK_SIZE (FunctionBlob, 20); CHECK_SIZE (InterfaceTypeBlob, 4); CHECK_SIZE (ArrayTypeBlob, 8); CHECK_SIZE (ParamTypeBlob, 4); @@ -315,7 +315,7 @@ validate_header (ValidateContext *ctx, } if (header->entry_blob_size != 12 || - header->function_blob_size != 16 || + header->function_blob_size != 20 || header->callback_blob_size != 12 || header->signal_blob_size != 12 || header->vfunc_blob_size != 16 || @@ -731,7 +731,7 @@ validate_function_blob (ValidateContext *ctx, g_set_error (error, G_TYPELIB_ERROR, G_TYPELIB_ERROR_INVALID_BLOB, - "Wrong blob type"); + "Wrong blob type %d, expected function", blob->blob_type); return FALSE; } diff --git a/girepository/gtypelib.h b/girepository/gtypelib.h index 7db15db..343f9e1 100644 --- a/girepository/gtypelib.h +++ b/girepository/gtypelib.h @@ -172,10 +172,17 @@ typedef struct guint16 wraps_vfunc : 1; guint16 throws : 1; guint16 index :10; + /* Note the bits above need to match CommonBlob + * and are thus exhausted, extend things using + * the reserved block below. */ guint32 name; guint32 symbol; guint32 signature; + + guint16 is_static : 1; + guint16 reserved : 15; + guint16 reserved2 : 16; } FunctionBlob; typedef struct |