summaryrefslogtreecommitdiff
path: root/giscanner/introspectablepass.py
diff options
context:
space:
mode:
authorJohan Dahlin <johan@gnome.org>2010-09-20 23:15:51 -0300
committerJohan Dahlin <johan@gnome.org>2010-09-20 23:31:17 -0300
commit97db362fd8e294a2079cf07fdc12e4771ef17424 (patch)
tree5edfe4e5d10db010c6801f9ee14d8b7508cff497 /giscanner/introspectablepass.py
parentf3bf705c1461d9bc64ced0e373b49bdf94319ec6 (diff)
downloadgobject-introspection-97db362fd8e294a2079cf07fdc12e4771ef17424.tar.gz
[IntrospectablePass] Improve error message
Send in block postions so we can get accurate line numbers for warnings emitted from this class.
Diffstat (limited to 'giscanner/introspectablepass.py')
-rw-r--r--giscanner/introspectablepass.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/giscanner/introspectablepass.py b/giscanner/introspectablepass.py
index 0de25c8d..cc3a59d3 100644
--- a/giscanner/introspectablepass.py
+++ b/giscanner/introspectablepass.py
@@ -44,16 +44,20 @@ class IntrospectablePass(object):
"""Virtual function %r has no known invoker""" % (vfunc.name, ),
context=node)
- def _parameter_warning(self, parent, param, text, *args):
+ def _parameter_warning(self, parent, param, text, position=None):
if hasattr(parent, 'symbol'):
prefix = '%s: ' % (parent.symbol, )
+ block = self._blocks.get(parent.symbol)
+ if block:
+ position = block.position
else:
prefix = ''
if isinstance(param, ast.Parameter):
context = "argument %s: " % (param.argname, )
else:
context = "return value: "
- message.warn_node(parent, prefix + context + text, *args)
+ message.warn_node(parent, prefix + context + text,
+ positions=position)
def _introspectable_param_analysis(self, parent, node):
is_return = isinstance(node, ast.Return)