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
This commit is contained in:
Colin Walters 2008-11-25 22:29:20 +00:00 committed by Johan Dahlin
parent e8718f0250
commit 74e22b307c
6 changed files with 17 additions and 7 deletions

View File

@ -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)

View File

@ -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;

View File

@ -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;

View File

@ -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 ||

View File

@ -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;
}

View File

@ -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