1
0
forked from VimPlug/jedi

Name.is_definition implementation.

This commit is contained in:
Dave Halter
2014-10-23 13:37:35 +02:00
parent 971f1db823
commit 88dcbe1f48

View File

@@ -238,6 +238,11 @@ class Name(_Leaf):
def get_definition(self):
return self.parent.get_parent_until((ArrayStmt, StatementElement, Node), reverse=True)
def is_definition(self):
stmt = self.get_definition()
return isinstance(stmt, (ExprStmt, Import)) \
and self in stmt.get_defined_names()
def assignment_indexes(self):
"""
Returns an array of ints of the indexes that are used in tuple