1
0
forked from VimPlug/jedi

Processing atom and power nodes.

This commit is contained in:
Dave Halter
2014-10-15 13:40:56 +02:00
parent 485b8ae3da
commit 631aa0ea61
2 changed files with 73 additions and 7 deletions

View File

@@ -218,7 +218,7 @@ class Name(_Leaf):
self.start_pos[0], self.start_pos[1])
def get_definition(self):
return self.parent.get_parent_until((ArrayStmt, StatementElement), reverse=True)
return self.parent.get_parent_until((ArrayStmt, StatementElement, Node), reverse=True)
class Literal(_Leaf):
@@ -1016,6 +1016,8 @@ class Statement(Simple, DocstringMixin):
names.append(first.children[i])
return names
return []
"""Get the names for the statement."""
if self._set_vars is None:
@@ -1040,6 +1042,14 @@ class Statement(Simple, DocstringMixin):
search_calls(self.expression_list())
return self._set_vars + self.as_names
def get_rhs(self):
"""Returns the right-hand-side of the equals."""
# TODO remove expr_stmt?
if is_node(self.children[0], 'expr_stmt'):
return self.children[0].children[-1]
else:
return self.children[0]
def get_names_dict(self):
"""The future of name resolution. Returns a dict(str -> Call)."""
dct = defaultdict(lambda: [])