1
0
forked from VimPlug/jedi

Make Leaf public

This commit is contained in:
Dave Halter
2014-10-28 11:13:33 +01:00
parent d667f19c57
commit 19e083cbfb
4 changed files with 8 additions and 11 deletions

View File

@@ -330,7 +330,6 @@ class NameFinder(object):
return doc_params return doc_params
if not isinstance(param, ExecutedParam): if not isinstance(param, ExecutedParam):
print(param)
# Param owns no information itself. # Param owns no information itself.
res_new += dynamic.search_params(evaluator, param) res_new += dynamic.search_params(evaluator, param)
if not res_new: if not res_new:

View File

@@ -297,10 +297,8 @@ def _unpack_var_args(evaluator, var_args, func):
# Include self at this place. # Include self at this place.
argument_list.append((None, [helpers.FakeStatement([func.instance])])) argument_list.append((None, [helpers.FakeStatement([func.instance])]))
print(var_args)
# `var_args` is typically an Array, and not a list. # `var_args` is typically an Array, and not a list.
for stmt in _reorder_var_args(var_args.iterate()): for stmt in _reorder_var_args(var_args.iterate()):
print(stmt)
if not isinstance(stmt, pr.Statement): if not isinstance(stmt, pr.Statement):
if stmt is None: if stmt is None:
argument_list.append((None, [])) argument_list.append((None, []))

View File

@@ -235,7 +235,7 @@ def get_instance_el(evaluator, instance, var, is_class_var=False):
Returns an InstanceElement if it makes sense, otherwise leaves the object Returns an InstanceElement if it makes sense, otherwise leaves the object
untouched. untouched.
""" """
if isinstance(var, (Instance, compiled.CompiledObject, pr.Operator, Token, if isinstance(var, (Instance, compiled.CompiledObject, pr.Leaf,
pr.Module, FunctionExecution, pr.Name)): pr.Module, FunctionExecution, pr.Name)):
if isinstance(var, pr.Name): if isinstance(var, pr.Name):
# TODO temp solution, remove later, Name should never get # TODO temp solution, remove later, Name should never get

View File

@@ -182,7 +182,7 @@ class Base(object):
return False return False
class _Leaf(Base): class Leaf(Base):
__slots__ = ('value', 'parent', 'start_pos', 'prefix') __slots__ = ('value', 'parent', 'start_pos', 'prefix')
def __init__(self, value, start_pos, prefix=''): def __init__(self, value, start_pos, prefix=''):
@@ -227,11 +227,11 @@ class _Leaf(Base):
return "<%s: %s>" % (type(self).__name__, repr(self.value)) return "<%s: %s>" % (type(self).__name__, repr(self.value))
class Whitespace(_Leaf): class Whitespace(Leaf):
"""Contains NEWLINE and ENDMARKER tokens.""" """Contains NEWLINE and ENDMARKER tokens."""
class Name(_Leaf): class Name(Leaf):
""" """
A string. Sometimes it is important to know if the string belongs to a name A string. Sometimes it is important to know if the string belongs to a name
or not. or not.
@@ -286,7 +286,7 @@ class Name(_Leaf):
return indexes return indexes
class Literal(_Leaf): class Literal(Leaf):
def eval(self): def eval(self):
return literal_eval(self.value) return literal_eval(self.value)
@@ -301,7 +301,7 @@ class Literal(_Leaf):
return "<%s: %s>" % (type(self).__name__, self.value) return "<%s: %s>" % (type(self).__name__, self.value)
class Operator(_Leaf): class Operator(Leaf):
def __str__(self): def __str__(self):
return self.value return self.value
@@ -323,7 +323,7 @@ class Operator(_Leaf):
return hash(self.value) return hash(self.value)
class Keyword(_Leaf): class Keyword(Leaf):
def __eq__(self, other): def __eq__(self, other):
""" """
Make comparisons with strings easy. Make comparisons with strings easy.
@@ -362,7 +362,7 @@ class Simple(Base):
Move the Node's start_pos. Move the Node's start_pos.
""" """
for c in self.children: for c in self.children:
if isinstance(c, _Leaf): if isinstance(c, Leaf):
c.start_pos = (c.start_pos[0] + line_offset, c.start_pos = (c.start_pos[0] + line_offset,
c.start_pos[1] + column_offset) c.start_pos[1] + column_offset)
else: else: