summaryrefslogtreecommitdiff
path: root/giscanner/maintransformer.py
diff options
context:
space:
mode:
authorJohan Dahlin <johan@gnome.org>2011-08-13 14:36:53 -0300
committerJohan Dahlin <jdahlin@litl.com>2011-08-13 14:36:53 -0300
commit81abc2eb63317003a11d1484e84698a37e8ec035 (patch)
tree624a3ccaf080c0b41b661b116238d7a0543f8c9c /giscanner/maintransformer.py
parenta8b700e2d9c7b63bd351f4194820680f4da3da8a (diff)
downloadgobject-introspection-81abc2eb63317003a11d1484e84698a37e8ec035.tar.gz
Try harder to preserve c:type
When we replace a type using annotation we should keep the ctype of the original type.
Diffstat (limited to 'giscanner/maintransformer.py')
-rw-r--r--giscanner/maintransformer.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/giscanner/maintransformer.py b/giscanner/maintransformer.py
index 1d26bf18..a86c7224 100644
--- a/giscanner/maintransformer.py
+++ b/giscanner/maintransformer.py
@@ -297,6 +297,10 @@ usage is void (*_gtk_reserved1)(void);"""
text = type_str
message.warn_node(parent, "%s: Unknown type: %r" %
(text, result.ctype), positions=position)
+ # If we replace a node with a new type (such as an annotated) we
+ # might lose the ctype from the original node.
+ if type_node is not None:
+ result.ctype = type_node.ctype
return result
def _get_position(self, func, param):
@@ -944,7 +948,7 @@ method or constructor of some type."""
# A quick hack here...in the future we should catch C signature/GI signature
# mismatches in a general way in finaltransformer
- if first.type.ctype is not None and first.type.ctype.count('*') != 1:
+ if first.type.ctype is not None and first.type.ctype.count('*') > 1:
return False
if not func.is_method: