Bug 556174 – parse types for lists etc.

2008-10-15  Tommi Komulainen  <tommi.komulainen@iki.fi>

	Bug 556174 – parse types for lists etc.

	* girepository/girparser.c (end_type_recurse):
	* tests/boxed.gir:
	* tools/generate.c (write_type_info, write_field_info,
	write_callable_info, write_callable_info, write_constant_info,
	write_property_info): use nested <type>s for lists and hashes

svn path=/trunk/; revision=717
This commit is contained in:
Tommi Komulainen 2008-10-15 22:08:26 +00:00 committed by Tommi Komulainen
parent 6e266d5f53
commit 9153ef51ae

View File

@ -1607,30 +1607,33 @@ end_type_recurse (ParseContext *ctx)
{ {
GList *types; GList *types;
GIrNodeType *parent; GIrNodeType *parent;
GIrNodeType *param = NULL;
parent = (GIrNodeType *) ((GList*)ctx->type_stack->data)->data; parent = (GIrNodeType *) ((GList*)ctx->type_stack->data)->data;
if (ctx->type_parameters)
param = (GIrNodeType *) ctx->type_parameters->data;
if (parent->tag == GI_TYPE_TAG_ARRAY || if (parent->tag == GI_TYPE_TAG_ARRAY ||
parent->tag == GI_TYPE_TAG_GLIST || parent->tag == GI_TYPE_TAG_GLIST ||
parent->tag == GI_TYPE_TAG_GSLIST) parent->tag == GI_TYPE_TAG_GSLIST)
{ {
if (ctx->type_parameters == NULL) g_assert (param != NULL);
parent->parameter_type1 = parse_type (ctx, "pointer");
if (parent->parameter_type1 == NULL)
parent->parameter_type1 = param;
else else
parent->parameter_type1 = (GIrNodeType*)ctx->type_parameters->data; g_assert_not_reached ();
} }
else if (parent->tag == GI_TYPE_TAG_GHASH) else if (parent->tag == GI_TYPE_TAG_GHASH)
{ {
if (ctx->type_parameters == NULL) g_assert (param != NULL);
{
parent->parameter_type1 = parse_type (ctx, "pointer"); if (parent->parameter_type1 == NULL)
parent->parameter_type2 = parse_type (ctx, "pointer"); parent->parameter_type1 = param;
} else if (parent->parameter_type2 == NULL)
parent->parameter_type2 = param;
else else
{ g_assert_not_reached ();
parent->parameter_type1 = (GIrNodeType*) ctx->type_parameters->data;
parent->parameter_type2 = (GIrNodeType*) ctx->type_parameters->next->data;
}
} }
g_list_free (ctx->type_parameters); g_list_free (ctx->type_parameters);
ctx->type_parameters = (GList *)ctx->type_stack->data; ctx->type_parameters = (GList *)ctx->type_stack->data;