1
0
forked from VimPlug/jedi

Adding prev_sibling, getting self attributes.

This commit is contained in:
Dave Halter
2014-10-23 14:03:52 +02:00
parent 88dcbe1f48
commit 387fc3b038
4 changed files with 29 additions and 6 deletions
+6 -1
View File
@@ -295,11 +295,16 @@ class FakeArray(pr.Array):
class FakeStatement(pr.ExprStmt):
def __init__(self, values, start_pos=(0, 0), parent=None):
p = start_pos
self._start_pos = start_pos
super(FakeStatement, self).__init__([])
self.values = values
self.parent = parent
@property
def start_pos(self):
"""Overwriting the original start_pos property."""
return self._start_pos
class FakeImport(pr.Import):
def __init__(self, name, parent, level=0):
+1
View File
@@ -394,6 +394,7 @@ def _gen_param_name_copy(func, var_args, param, keys=(), values=(), array_type=N
"""
Create a param with the original scope (of varargs) as parent.
"""
print(func, var_args, param, keys, values, array_type)
if isinstance(var_args, pr.Array):
parent = var_args.parent
start_pos = var_args.start_pos
+6 -5
View File
@@ -155,13 +155,14 @@ class Instance(use_metaclass(CachedMetaClass, Executed)):
# because to follow them and their self variables is too
# complicated.
sub = self._get_method_execution(sub)
print(sub.names_dict.values())
for name_list in sub.names_dict.values():
for name in name_list:
if name.value == self_name:
next = name.next_sibling()
if isinstance(next, pr.Name) and next.is_definition():
names.append(get_instance_el(self._evaluator, self, next))
if name.value == self_name and name.prev_sibling() is None:
trailer = name.next_sibling()
if pr.is_node(trailer, 'trailer') \
and len(trailer.children) == 2:
name = trailer.children[1] # After dot.
names.append(get_instance_el(self._evaluator, self, name))
for s in self.base.py__bases__(self._evaluator):
if not isinstance(s, compiled.CompiledObject):