summaryrefslogtreecommitdiff
path: root/girepository/girparser.c
diff options
context:
space:
mode:
authorTorsten Schönfeld <kaffeetisch@gmx.de>2011-08-13 17:28:30 +0200
committerTorsten Schönfeld <kaffeetisch@gmx.de>2011-08-16 18:43:23 +0200
commit169b206cbb4b347e4b17854e8f0c62a40404f803 (patch)
tree929ddaefcedf7c9d4778ea355e58f0b1cc2f2f96 /girepository/girparser.c
parent64848acb817369436d629d153c5750789c0addc3 (diff)
downloadgobject-introspection-169b206cbb4b347e4b17854e8f0c62a40404f803.tar.gz
Allow enums and bitfields to have static methods
This uses the same backcompat machinery that was introduced for static methods for non-class types, so this change does not break users of the existing presentations. New libgirepository API: g_enum_info_get_n_methods g_enum_info_get_method https://bugzilla.gnome.org/show_bug.cgi?id=656499
Diffstat (limited to 'girepository/girparser.c')
-rw-r--r--girepository/girparser.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/girepository/girparser.c b/girepository/girparser.c
index c9b7d629..6984e826 100644
--- a/girepository/girparser.c
+++ b/girepository/girparser.c
@@ -805,6 +805,9 @@ start_function (GMarkupParseContext *context,
strcmp (element_name, "method") == 0 ||
strcmp (element_name, "callback") == 0);
break;
+ case STATE_ENUM:
+ found = strcmp (element_name, "function") == 0;
+ break;
case STATE_STRUCT_FIELD:
found = (found || strcmp (element_name, "callback") == 0);
break;
@@ -925,6 +928,15 @@ start_function (GMarkupParseContext *context,
union_->members = g_list_append (union_->members, function);
}
break;
+ case G_IR_NODE_ENUM:
+ case G_IR_NODE_FLAGS:
+ {
+ GIrNodeEnum *enum_;
+
+ enum_ = (GIrNodeEnum *)CURRENT_NODE (ctx);
+ enum_->methods = g_list_append (enum_->methods, function);
+ }
+ break;
default:
g_assert_not_reached ();
}
@@ -3186,6 +3198,9 @@ end_element_handler (GMarkupParseContext *context,
state_switch (ctx, STATE_STRUCT);
else if (CURRENT_NODE (ctx)->type == G_IR_NODE_UNION)
state_switch (ctx, STATE_UNION);
+ else if (CURRENT_NODE (ctx)->type == G_IR_NODE_ENUM ||
+ CURRENT_NODE (ctx)->type == G_IR_NODE_FLAGS)
+ state_switch (ctx, STATE_ENUM);
else
{
int line_number, char_number;
@@ -3256,6 +3271,8 @@ end_element_handler (GMarkupParseContext *context,
case STATE_ENUM:
if (strcmp ("member", element_name) == 0)
break;
+ else if (strcmp ("function", element_name) == 0)
+ break;
else if (require_one_of_end_elements (context, ctx,
element_name, error, "enumeration",
"bitfield", NULL))