forked from VimPlug/jedi
More removals and cleanups.
This commit is contained in:
@@ -252,7 +252,8 @@ class Node(Base):
|
|||||||
for el in child.post_order():
|
for el in child.post_order():
|
||||||
yield el
|
yield el
|
||||||
|
|
||||||
def _prefix_getter(self):
|
@property
|
||||||
|
def prefix(self):
|
||||||
"""
|
"""
|
||||||
The whitespace and comments preceding this node in the input.
|
The whitespace and comments preceding this node in the input.
|
||||||
"""
|
"""
|
||||||
@@ -260,11 +261,12 @@ class Node(Base):
|
|||||||
return ""
|
return ""
|
||||||
return self.children[0].prefix
|
return self.children[0].prefix
|
||||||
|
|
||||||
def _prefix_setter(self, prefix):
|
@prefix.setter
|
||||||
|
def prefix(self, prefix):
|
||||||
if self.children:
|
if self.children:
|
||||||
self.children[0].prefix = prefix
|
self.children[0].prefix = prefix
|
||||||
|
else:
|
||||||
prefix = property(_prefix_getter, _prefix_setter)
|
raise NotImplementedError
|
||||||
|
|
||||||
def set_child(self, i, child):
|
def set_child(self, i, child):
|
||||||
"""
|
"""
|
||||||
@@ -274,7 +276,6 @@ class Node(Base):
|
|||||||
child.parent = self
|
child.parent = self
|
||||||
self.children[i].parent = None
|
self.children[i].parent = None
|
||||||
self.children[i] = child
|
self.children[i] = child
|
||||||
self.changed()
|
|
||||||
|
|
||||||
def insert_child(self, i, child):
|
def insert_child(self, i, child):
|
||||||
"""
|
"""
|
||||||
@@ -283,7 +284,6 @@ class Node(Base):
|
|||||||
"""
|
"""
|
||||||
child.parent = self
|
child.parent = self
|
||||||
self.children.insert(i, child)
|
self.children.insert(i, child)
|
||||||
self.changed()
|
|
||||||
|
|
||||||
def append_child(self, child):
|
def append_child(self, child):
|
||||||
"""
|
"""
|
||||||
@@ -292,7 +292,6 @@ class Node(Base):
|
|||||||
"""
|
"""
|
||||||
child.parent = self
|
child.parent = self
|
||||||
self.children.append(child)
|
self.children.append(child)
|
||||||
self.changed()
|
|
||||||
|
|
||||||
|
|
||||||
class Leaf(Base):
|
class Leaf(Base):
|
||||||
@@ -316,8 +315,8 @@ class Leaf(Base):
|
|||||||
self._prefix, (self.lineno, self.column) = context
|
self._prefix, (self.lineno, self.column) = context
|
||||||
self.type = type
|
self.type = type
|
||||||
self.value = value
|
self.value = value
|
||||||
if prefix is not None:
|
# The whitespace and comments preceding this token in the input.
|
||||||
self._prefix = prefix
|
self.prefix = prefix or ''
|
||||||
|
|
||||||
def __repr__(self):
|
def __repr__(self):
|
||||||
"""Return a canonical string representation."""
|
"""Return a canonical string representation."""
|
||||||
@@ -351,18 +350,6 @@ class Leaf(Base):
|
|||||||
"""Return a pre-order iterator for the tree."""
|
"""Return a pre-order iterator for the tree."""
|
||||||
yield self
|
yield self
|
||||||
|
|
||||||
def _prefix_getter(self):
|
|
||||||
"""
|
|
||||||
The whitespace and comments preceding this token in the input.
|
|
||||||
"""
|
|
||||||
return self._prefix
|
|
||||||
|
|
||||||
def _prefix_setter(self, prefix):
|
|
||||||
self.changed()
|
|
||||||
self._prefix = prefix
|
|
||||||
|
|
||||||
prefix = property(_prefix_getter, _prefix_setter)
|
|
||||||
|
|
||||||
|
|
||||||
def convert(gr, raw_node):
|
def convert(gr, raw_node):
|
||||||
"""
|
"""
|
||||||
|
|||||||
Reference in New Issue
Block a user