summaryrefslogtreecommitdiff
path: root/giscanner
diff options
context:
space:
mode:
authorAndreas Rottmann <a.rottmann@gmx.at>2010-10-05 23:49:33 +0200
committerAndreas Rottmann <a.rottmann@gmx.at>2010-10-05 23:49:33 +0200
commitd15e386c8e10dd6b645a444e29cc053100089a07 (patch)
tree295caab07108aecfc7d6c8b774b02cea4745b89b /giscanner
parent4b94812bbfff446ac7d1684d67607be6a7cab4ec (diff)
downloadgobject-introspection-d15e386c8e10dd6b645a444e29cc053100089a07.tar.gz
Apply `(type bitfield)' annotations for enums
Previously, such annotations would be ignored.
Diffstat (limited to 'giscanner')
-rw-r--r--giscanner/maintransformer.py11
1 files changed, 9 insertions, 2 deletions
diff --git a/giscanner/maintransformer.py b/giscanner/maintransformer.py
index 89f7ff65..9053abf4 100644
--- a/giscanner/maintransformer.py
+++ b/giscanner/maintransformer.py
@@ -219,8 +219,9 @@ usage is void (*_gtk_reserved1)(void);"""
self._apply_annotations_function(node, chain)
if isinstance(node, ast.Callback):
self._apply_annotations_callable(node, chain, block = self._get_block(node))
- if isinstance(node, (ast.Class, ast.Interface, ast.Union, ast.Enum,
- ast.Bitfield, ast.Callback)):
+ if isinstance(node, (ast.Enum, ast.Bitfield)):
+ self._apply_annotations_enum(node, self._get_block(node))
+ if isinstance(node, (ast.Class, ast.Interface, ast.Union, ast.Callback)):
self._apply_annotations_annotated(node, self._get_block(node))
if isinstance(node, (ast.Class, ast.Interface, ast.Record, ast.Union)):
block = self._get_block(node)
@@ -409,6 +410,12 @@ usage is void (*_gtk_reserved1)(void);"""
message.warn_node(parent,
"Unknown container %r for element-type annotation" % (node.type, ))
+ def _apply_annotations_enum(self, node, block):
+ enum_type = block.options.get(OPT_TYPE)
+ if enum_type and enum_type.one() == 'bitfield':
+ node.__class__ = ast.Bitfield
+ self._apply_annotations_annotated(node, block)
+
def _get_transfer_default_param(self, parent, node):
if node.direction in [ast.PARAM_DIRECTION_INOUT,
ast.PARAM_DIRECTION_OUT]: