Make error more verbose in parser

By printing the function when arguments are missing

https://bugzilla.gnome.org/show_bug.cgi?id=604161
This commit is contained in:
Bastien Nocera 2009-12-09 11:21:30 +00:00
parent c22f11f1b8
commit e3cd97d492

View File

@ -840,11 +840,14 @@ start_function (GMarkupParseContext *context,
} }
static void static void
parse_param_transfer (GIrNodeParam *param, const gchar *transfer) parse_param_transfer (GIrNodeParam *param, const gchar *transfer, const gchar *name)
{ {
if (transfer == NULL) if (transfer == NULL)
{ {
if (!name)
g_warning ("required attribute 'transfer-ownership' missing"); g_warning ("required attribute 'transfer-ownership' missing");
else
g_warning ("required attribute 'transfer-ownership' for function '%s'", name);
} }
else if (strcmp (transfer, "none") == 0) else if (strcmp (transfer, "none") == 0)
{ {
@ -948,7 +951,7 @@ start_parameter (GMarkupParseContext *context,
else else
param->allow_none = FALSE; param->allow_none = FALSE;
parse_param_transfer (param, transfer); parse_param_transfer (param, transfer, name);
if (scope && strcmp (scope, "call") == 0) if (scope && strcmp (scope, "call") == 0)
param->scope = GI_SCOPE_TYPE_CALL; param->scope = GI_SCOPE_TYPE_CALL;
@ -1950,7 +1953,7 @@ start_return_value (GMarkupParseContext *context,
state_switch (ctx, STATE_FUNCTION_RETURN); state_switch (ctx, STATE_FUNCTION_RETURN);
transfer = find_attribute ("transfer-ownership", attribute_names, attribute_values); transfer = find_attribute ("transfer-ownership", attribute_names, attribute_values);
parse_param_transfer (param, transfer); parse_param_transfer (param, transfer, NULL);
switch (CURRENT_NODE (ctx)->type) switch (CURRENT_NODE (ctx)->type)
{ {