Allow attributes on parameters and return values

Any annotation where the key has a dot in the name will go into the
attribute list. For example

  * @arg: (foo.bar baz): some arg

the parameter @arg will get the attribute with key foo.bar and value
baz. This also works for.

  * Returns: (foo.bar2 baz2): the return value

Also add tests for this new feature.

See https://bugzilla.gnome.org/show_bug.cgi?id=571548

Signed-off-by: David Zeuthen <davidz@redhat.com>
This commit is contained in:
David Zeuthen
2010-06-15 11:01:37 -04:00
parent c57c9efe6f
commit 3d0dc7d214
7 changed files with 148 additions and 8 deletions

View File

@@ -1678,6 +1678,14 @@ g_ir_node_build_typelib (GIrNode *node,
blob->symbol = write_string (function->symbol, strings, data, offset2);
blob->signature = signature;
/* function->result is special since it doesn't appear in the serialized format but
* we do want the attributes for it to appear
*/
build->nodes_with_attributes = g_list_prepend (build->nodes_with_attributes, function->result);
build->n_attributes += g_hash_table_size (((GIrNode *) function->result)->attributes);
g_assert (((GIrNode *) function->result)->offset == 0);
((GIrNode *) function->result)->offset = signature;
g_debug ("building function '%s'", function->symbol);
g_ir_node_build_typelib ((GIrNode *)function->result->type,
@@ -1770,6 +1778,14 @@ g_ir_node_build_typelib (GIrNode *node,
blob->name = write_string (node->name, strings, data, offset2);
blob->signature = signature;
/* signal->result is special since it doesn't appear in the serialized format but
* we do want the attributes for it to appear
*/
build->nodes_with_attributes = g_list_prepend (build->nodes_with_attributes, signal->result);
build->n_attributes += g_hash_table_size (((GIrNode *) signal->result)->attributes);
g_assert (((GIrNode *) signal->result)->offset == 0);
((GIrNode *) signal->result)->offset = signature;
g_ir_node_build_typelib ((GIrNode *)signal->result->type,
node, build, &signature, offset2);