diff options
-rw-r--r-- | girepository/girparser.c | 4 | ||||
-rw-r--r-- | tests/repository/gitypelibtest.c | 39 |
2 files changed, 43 insertions, 0 deletions
diff --git a/girepository/girparser.c b/girepository/girparser.c index 6984e826..0a4a65d8 100644 --- a/girepository/girparser.c +++ b/girepository/girparser.c @@ -1947,6 +1947,10 @@ start_type (GMarkupParseContext *context, const char *cp = ctype + strlen(ctype) - 1; while (cp > ctype && *cp-- == '*') pointer_depth++; + + if (g_str_has_prefix (ctype, "gpointer") + || g_str_has_prefix (ctype, "gconstpointer")) + pointer_depth++; } if (ctx->current_typed->type == G_IR_NODE_PARAM && diff --git a/tests/repository/gitypelibtest.c b/tests/repository/gitypelibtest.c index 6e69b096..de821e01 100644 --- a/tests/repository/gitypelibtest.c +++ b/tests/repository/gitypelibtest.c @@ -131,6 +131,44 @@ test_size_of_struct_with_array_of_anon_unions(GIRepository *repo) g_base_info_unref (struct_info); } +static void +test_is_pointer_for_struct_arg (GIRepository *repo) +{ + GITypelib *ret; + GError *error = NULL; + GIStructInfo *variant_info; + GIFunctionInfo *equal_info; + GIArgInfo *arg_info; + GITypeInfo *type_info; + + ret = g_irepository_require (repo, "GLib", NULL, 0, &error); + if (!ret) + g_error ("%s", error->message); + + variant_info = g_irepository_find_by_name (repo, "GLib", "Variant"); + if (!variant_info) + g_error ("Could not find GLib.Variant"); + + equal_info = g_struct_info_find_method (variant_info, "equal"); + if (!equal_info) + g_error ("Could not find GLib.Variant.equal()"); + + arg_info = g_callable_info_get_arg (equal_info, 0); + if (!arg_info) + g_error ("Could not find 1st arg of GLib.Variant.equal()"); + + type_info = g_arg_info_get_type (arg_info); + if (!type_info) + g_error ("Could not find typeinfo of 1st arg of GLib.Variant.equal()"); + + g_assert (g_type_info_is_pointer (type_info)); + + g_base_info_unref (type_info); + g_base_info_unref (arg_info); + g_base_info_unref (equal_info); + g_base_info_unref (variant_info); +} + int main(int argc, char **argv) { @@ -144,6 +182,7 @@ main(int argc, char **argv) test_enum_and_flags_cidentifier (repo); test_enum_and_flags_static_methods (repo); test_size_of_struct_with_array_of_anon_unions (repo); + test_is_pointer_for_struct_arg (repo); exit(0); } |