Use tag position if available
authorJohan Dahlin <johan@gnome.org>
Fri, 24 Sep 2010 21:22:35 +0000 (18:22 -0300)
committerJohan Dahlin <johan@gnome.org>
Fri, 24 Sep 2010 21:22:35 +0000 (18:22 -0300)
giscanner/introspectablepass.py

index 7de9b929bb40044b6cce53a79b85c9bd5c437157..ef2ddf764b366d0e44c97c2247f7e1b6d5674b2f 100644 (file)
@@ -19,6 +19,7 @@
 
 from . import ast
 from . import message
+from .annotationparser import TAG_RETURNS
 
 class IntrospectablePass(object):
 
@@ -50,6 +51,7 @@ class IntrospectablePass(object):
         if isinstance(parent, (ast.VFunction, ast.Callback)):
             return
 
+        block = None
         if hasattr(parent, 'symbol'):
             prefix = '%s: ' % (parent.symbol, )
             block = self._blocks.get(parent.symbol)
@@ -61,6 +63,10 @@ class IntrospectablePass(object):
             context = "argument %s: " % (param.argname, )
         else:
             context = "return value: "
+            if block:
+                return_tag = block.get(TAG_RETURNS)
+                if return_tag:
+                    position = return_tag.position
         message.warn_node(parent, prefix + context + text,
                           positions=position)