summaryrefslogtreecommitdiff
path: root/giscanner
diff options
context:
space:
mode:
authorColin Walters <walters@verbum.org>2010-09-14 12:23:59 -0400
committerColin Walters <walters@verbum.org>2010-09-14 12:24:43 -0400
commit53b4da85dcb49d1fd3dc5e4033e476119653b214 (patch)
tree1fc438f858c5893b3d96be96c0d49495f8e05190 /giscanner
parent303255d484165f7d2e3e3ad298168da43edcbd2e (diff)
scanner: Parse annotations for typedefs
* Explicitly check for ast.Alias in annotation pass * Add "generic" attribs handling for aliases like docs, introspectable=0 etc. https://bugzilla.gnome.org/show_bug.cgi?id=629668
Diffstat (limited to 'giscanner')
-rw-r--r--giscanner/girparser.py1
-rw-r--r--giscanner/girwriter.py2
-rw-r--r--giscanner/maintransformer.py8
3 files changed, 10 insertions, 1 deletions
diff --git a/giscanner/girparser.py b/giscanner/girparser.py
index ab2b29d..582dcc0 100644
--- a/giscanner/girparser.py
+++ b/giscanner/girparser.py
@@ -179,6 +179,7 @@ class GIRParser(object):
alias = ast.Alias(node.attrib['name'],
typeval,
node.attrib.get(_cns('type')))
+ self._parse_generic_attribs(node, alias)
self._namespace.append(alias)
def _parse_generic_attribs(self, node, obj):
diff --git a/giscanner/girwriter.py b/giscanner/girwriter.py
index a450bb1..d3b023a 100644
--- a/giscanner/girwriter.py
+++ b/giscanner/girwriter.py
@@ -154,7 +154,9 @@ and/or use gtk-doc annotations. ''')
attrs = [('name', alias.name)]
if alias.ctype is not None:
attrs.append(('c:type', alias.ctype))
+ self._append_node_generic(alias, attrs)
with self.tagcontext('alias', attrs):
+ self._write_generic(alias)
self._write_type(alias.target)
def _write_callable(self, callable, tag_name, extra_attrs):
diff --git a/giscanner/maintransformer.py b/giscanner/maintransformer.py
index 74873a3..a7f2b61 100644
--- a/giscanner/maintransformer.py
+++ b/giscanner/maintransformer.py
@@ -176,7 +176,7 @@ usage is void (*_gtk_reserved1)(void);"""
def _get_annotation_name(self, node):
if isinstance(node, (ast.Class, ast.Interface, ast.Record,
ast.Union, ast.Enum, ast.Bitfield,
- ast.Callback)):
+ ast.Callback, ast.Alias)):
if node.ctype is not None:
return node.ctype
elif isinstance(node, ast.Registered) and node.gtype_name is not None:
@@ -190,6 +190,8 @@ usage is void (*_gtk_reserved1)(void);"""
def _pass_read_annotations(self, node, chain):
if not node.namespace:
return False
+ if isinstance(node, ast.Alias):
+ self._apply_annotations_alias(node, chain)
if isinstance(node, ast.Function):
self._apply_annotations_function(node, chain)
if isinstance(node, ast.Callback):
@@ -500,6 +502,10 @@ usage is void (*_gtk_reserved1)(void);"""
if OPT_FOREIGN in block.options:
node.foreign = True
+ def _apply_annotations_alias(self, node, chain):
+ block = self._get_block(node)
+ self._apply_annotations_annotated(node, block)
+
def _apply_annotations_param(self, parent, param, tag):
if tag:
options = tag.options