summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohan Dahlin <johan@gnome.org>2010-09-20 23:01:27 -0300
committerJohan Dahlin <johan@gnome.org>2010-09-20 23:01:27 -0300
commit15702c7ad0654aa17484ab7380f71a91201fdb04 (patch)
tree3cc74d2b8068152c4457c8409e4e7c1b6205e024
parent8398ce7b33dd9b6866795998d60e9bc7bb7090e2 (diff)
downloadgobject-introspection-15702c7ad0654aa17484ab7380f71a91201fdb04.tar.gz
[message] Add apositions argument to a few functions
-rw-r--r--giscanner/message.py14
1 files changed, 8 insertions, 6 deletions
diff --git a/giscanner/message.py b/giscanner/message.py
index baac0365..c6e2a392 100644
--- a/giscanner/message.py
+++ b/giscanner/message.py
@@ -124,13 +124,15 @@ If the warning is related to a ast.Node type, see log_node_warning()."""
if log_type == FATAL:
raise SystemExit(text)
- def log_node(self, log_type, node, text, context=None):
+ def log_node(self, log_type, node, text, context=None, positions=None):
"""Log a warning, using information about file positions from
the given node. The optional context argument, if given, should be
another ast.Node type which will also be displayed. If no file position
information is available from the node, the position data from the
context will be used."""
- if getattr(node, 'file_positions', None):
+ if positions:
+ pass
+ elif getattr(node, 'file_positions', None):
positions = node.file_positions
elif context and context.file_positions:
positions = context.file_positions
@@ -152,16 +154,16 @@ context will be used."""
prefix="symbol=%r" % (symbol.ident, ))
-def log_node(log_type, node, text, context=None):
+def log_node(log_type, node, text, context=None, positions=None):
ml = MessageLogger.get()
- ml.log_node(log_type, node, text, context=context)
+ ml.log_node(log_type, node, text, context=context, positions=positions)
def warn(text, positions=None, prefix=None):
ml = MessageLogger.get()
ml.log(WARNING, text, positions, prefix)
-def warn_node(node, text, context=None):
- log_node(WARNING, node, text, context=context)
+def warn_node(node, text, context=None, positions=None):
+ log_node(WARNING, node, text, context=context, positions=positions)
def warn_symbol(symbol, text):
ml = MessageLogger.get()