1
0
forked from VimPlug/jedi

A move function for Nodes.

This commit is contained in:
Dave Halter
2014-10-12 23:37:46 +02:00
parent 660124aca1
commit 0def3afaaa
3 changed files with 16 additions and 5 deletions

View File

@@ -286,6 +286,17 @@ class Simple(Base):
self.children = children
self.parent = None
def move(self, line_offset, column_offset):
"""
Move the Node's start_pos.
"""
for c in self.children:
if isinstance(c, _Leaf):
c.start_pos = (c.start_pos[0] + line_offset,
c.start_pos[1] + column_offset)
else:
c.move(line_offset, column_offset)
@property
def start_pos(self):
return self.children[0].start_pos