diff --git a/girepository/gicallableinfo.c b/girepository/gicallableinfo.c index bcb37a792..551fe961d 100644 --- a/girepository/gicallableinfo.c +++ b/girepository/gicallableinfo.c @@ -135,10 +135,12 @@ gi_callable_info_can_throw_gerror (GICallableInfo *info) * * Determines if the callable info is a method. * - * For [class@GIRepository.VFuncInfo]s and [class@GIRepository.SignalInfo]s, - * this is always true, and for [class@GIRepository.CallbackInfo]s always false. - * Otherwise, this looks at the `GI_FUNCTION_IS_METHOD` flag on the - * [class@GIRepository.FunctionInfo]. + * For [class@GIRepository.SignalInfo]s, this is always true, and for + * [class@GIRepository.CallbackInfo]s always false. + * For [class@GIRepository.FunctionInfo]s this looks at the + * `GI_FUNCTION_IS_METHOD` flag on the [class@GIRepository.FunctionInfo]. + * For [class@GIRepository.VFuncInfo]s this is true when the virtual function + * has an instance parameter. * * Concretely, this function returns whether * [method@GIRepository.CallableInfo.get_n_args] matches the number of arguments @@ -160,6 +162,11 @@ gi_callable_info_is_method (GICallableInfo *info) return (!blob->constructor && !blob->is_static); } case GI_INFO_TYPE_VFUNC: + { + VFuncBlob *blob; + blob = (VFuncBlob *) &rinfo->typelib->data[rinfo->offset]; + return !blob->is_static; + } case GI_INFO_TYPE_SIGNAL: return TRUE; case GI_INFO_TYPE_CALLBACK: diff --git a/girepository/girnode-private.h b/girepository/girnode-private.h index 652eb92a0..6bb814e38 100644 --- a/girepository/girnode-private.h +++ b/girepository/girnode-private.h @@ -243,6 +243,8 @@ struct _GIIrNodeVFunc uint8_t instance_transfer_full : 1; uint8_t is_async : 1; + uint8_t is_static : 1; + char *invoker; /* (owned) */ char *finish_func; /* (owned) */ char *sync_func; /* (owned) */ diff --git a/girepository/girnode.c b/girepository/girnode.c index 15084ceba..65641625d 100644 --- a/girepository/girnode.c +++ b/girepository/girnode.c @@ -2029,6 +2029,7 @@ gi_ir_node_build_typelib (GIIrNode *node, blob->struct_offset = vfunc->offset; blob->reserved2 = 0; blob->signature = signature; + blob->is_static = vfunc->is_static; gi_ir_node_build_typelib ((GIIrNode *)vfunc->result->type, node, build, &signature, offset2, NULL); diff --git a/girepository/girparser.c b/girepository/girparser.c index 7a111f0d9..0cf341533 100644 --- a/girepository/girparser.c +++ b/girepository/girparser.c @@ -2660,6 +2660,7 @@ start_vfunc (GMarkupParseContext *context, const char *offset; const char *invoker; const char *throws; + const char *is_static; const char *finish_func; const char *async_func; const char *sync_func; @@ -2682,6 +2683,7 @@ start_vfunc (GMarkupParseContext *context, offset = find_attribute ("offset", attribute_names, attribute_values); invoker = find_attribute ("invoker", attribute_names, attribute_values); throws = find_attribute ("throws", attribute_names, attribute_values); + is_static = find_attribute ("glib:static", attribute_names, attribute_values); finish_func = find_attribute ("glib:finish-func", attribute_names, attribute_values); sync_func = find_attribute ("glib:sync-func", attribute_names, attribute_values); async_func = find_attribute ("glib:async-func", attribute_names, attribute_values); @@ -2728,6 +2730,11 @@ start_vfunc (GMarkupParseContext *context, else vfunc->throws = FALSE; + if (is_static && strcmp (is_static, "1") == 0) + vfunc->is_static = TRUE; + else + vfunc->is_static = FALSE; + if (offset == NULL) vfunc->offset = 0xFFFF; else if (g_ascii_string_to_unsigned (offset, 10, 0, G_MAXSIZE, &parsed_offset, error)) diff --git a/girepository/gitypelib-internal.h b/girepository/gitypelib-internal.h index cb5610ef6..74cf1b4dc 100644 --- a/girepository/gitypelib-internal.h +++ b/girepository/gitypelib-internal.h @@ -1117,6 +1117,7 @@ typedef struct { * @invoker: If a method invoker for this virtual exists, this is the offset * in the class structure of the method. If no method is known, this value * will be 0x3ff. + * @is_static: True if the vfunc has no instance parameter. * @reserved: Reserved for future use. * @finish: The index of the finish function if is_async is TRUE, otherwise ASYNC_SENTINEL * @reserved2: Reserved for future use. @@ -1142,7 +1143,8 @@ typedef struct { uint16_t struct_offset; uint16_t invoker : 10; /* Number of bits matches @index in FunctionBlob */ - uint16_t reserved : 6; + uint16_t is_static : 1; + uint16_t reserved : 5; uint16_t finish : 10; uint16_t reserved2 : 6;