forked from VimPlug/jedi
Move is_side_effect to BaseDefinition
This commit is contained in:
@@ -357,6 +357,16 @@ class BaseDefinition(object):
|
|||||||
|
|
||||||
return self._name.get_root_context().is_stub()
|
return self._name.get_root_context().is_stub()
|
||||||
|
|
||||||
|
def is_side_effect(self):
|
||||||
|
"""
|
||||||
|
Checks if a name is defined as ``self.foo = 3``. In case of self, this
|
||||||
|
function would return False, for foo it would return True.
|
||||||
|
"""
|
||||||
|
tree_name = self._name.tree_name
|
||||||
|
if tree_name is None:
|
||||||
|
return False
|
||||||
|
return tree_name.is_definition() and tree_name.parent.type == 'trailer'
|
||||||
|
|
||||||
def goto(self, **kwargs):
|
def goto(self, **kwargs):
|
||||||
with debug.increase_indent_cm('goto for %s' % self._name):
|
with debug.increase_indent_cm('goto for %s' % self._name):
|
||||||
return self._goto(**kwargs)
|
return self._goto(**kwargs)
|
||||||
@@ -703,16 +713,6 @@ class Definition(BaseDefinition):
|
|||||||
else:
|
else:
|
||||||
return self._name.tree_name.is_definition()
|
return self._name.tree_name.is_definition()
|
||||||
|
|
||||||
def is_side_effect(self):
|
|
||||||
"""
|
|
||||||
Checks if a name is defined as ``self.foo = 3``. In case of self, this
|
|
||||||
function would return False, for foo it would return True.
|
|
||||||
"""
|
|
||||||
tree_name = self._name.tree_name
|
|
||||||
if tree_name is None:
|
|
||||||
return False
|
|
||||||
return tree_name.is_definition() and tree_name.parent.type == 'trailer'
|
|
||||||
|
|
||||||
def __eq__(self, other):
|
def __eq__(self, other):
|
||||||
return self._name.start_pos == other._name.start_pos \
|
return self._name.start_pos == other._name.start_pos \
|
||||||
and self.module_path == other.module_path \
|
and self.module_path == other.module_path \
|
||||||
|
|||||||
Reference in New Issue
Block a user