diff options
author | Sylvain Thénault <sylvain.thenault@logilab.fr> | 2011-06-16 19:13:15 +0200 |
---|---|---|
committer | Sylvain Thénault <sylvain.thenault@logilab.fr> | 2011-06-16 19:13:15 +0200 |
commit | 9d8800ca5703f364518240016aaed8e5434b2472 (patch) | |
tree | 3df0b337f34920f3064980341cdadf4b60e5d93c | |
parent | db7ea8451a98b437ee635e99d83944f2a9d3acc2 (diff) | |
download | astroid-git-9d8800ca5703f364518240016aaed8e5434b2472.tar.gz |
closes #69217: please add column offset to the astng node
-rw-r--r-- | ChangeLog | 3 | ||||
-rw-r--r-- | bases.py | 1 | ||||
-rw-r--r-- | rebuilder.py | 4 |
3 files changed, 8 insertions, 0 deletions
@@ -1,6 +1,9 @@ Change log for the astng package ================================ +-- + * added column offset information on nodes (patch by fawce) + 2011-01-11 -- 0.21.1 * python3: handle file encoding; fix a lot of tests @@ -336,6 +336,7 @@ class NodeNG(object): lineno = None fromlineno = None tolineno = None + col_offset = None # parent node in the tree parent = None # attributes containing child node(s) redefined in most concrete classes: diff --git a/rebuilder.py b/rebuilder.py index d86013e3..69173f2a 100644 --- a/rebuilder.py +++ b/rebuilder.py @@ -117,11 +117,15 @@ def _lineno_parent(oldnode, newnode, parent): newnode.parent = parent if hasattr(oldnode, 'lineno'): newnode.lineno = oldnode.lineno + if hasattr(oldnode, 'col_offset'): + newnode.col_offset = oldnode.col_offset def _set_infos(oldnode, newnode, parent): newnode.parent = parent if hasattr(oldnode, 'lineno'): newnode.lineno = oldnode.lineno + if hasattr(oldnode, 'col_offset'): + newnode.col_offset = oldnode.col_offset newnode.set_line_info(newnode.last_child()) # set_line_info accepts None |