From 97db362fd8e294a2079cf07fdc12e4771ef17424 Mon Sep 17 00:00:00 2001 From: Johan Dahlin Date: Mon, 20 Sep 2010 23:15:51 -0300 Subject: [IntrospectablePass] Improve error message Send in block postions so we can get accurate line numbers for warnings emitted from this class. --- giscanner/introspectablepass.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'giscanner') 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) -- cgit v1.2.1