mirror of
https://github.com/davidhalter/jedi.git
synced 2025-12-07 22:44:27 +08:00
Fix issue https://github.com/DamnWidget/anaconda/issues/449. Using self should not cause side effects in completion.
This commit is contained in:
@@ -819,7 +819,6 @@ def create_index_types(evaluator, index):
|
|||||||
Handles slices in subscript nodes.
|
Handles slices in subscript nodes.
|
||||||
"""
|
"""
|
||||||
if tree.is_node(index, 'subscript'): # subscript is a slice operation.
|
if tree.is_node(index, 'subscript'): # subscript is a slice operation.
|
||||||
start, stop, step = None, None, None
|
|
||||||
result = []
|
result = []
|
||||||
for el in index.children:
|
for el in index.children:
|
||||||
if el == ':':
|
if el == ':':
|
||||||
|
|||||||
@@ -377,6 +377,10 @@ class Name(Leaf):
|
|||||||
self.start_pos[0], self.start_pos[1])
|
self.start_pos[0], self.start_pos[1])
|
||||||
|
|
||||||
def is_definition(self):
|
def is_definition(self):
|
||||||
|
if self.parent.type in ('power', 'atom_expr'):
|
||||||
|
# In `self.x = 3` self is not a definition, but x is.
|
||||||
|
return False
|
||||||
|
|
||||||
stmt = self.get_definition()
|
stmt = self.get_definition()
|
||||||
if stmt.type in ('funcdef', 'classdef', 'file_input', 'param'):
|
if stmt.type in ('funcdef', 'classdef', 'file_input', 'param'):
|
||||||
return self == stmt.name
|
return self == stmt.name
|
||||||
|
|||||||
@@ -386,3 +386,18 @@ recursion1([1,2])[0]
|
|||||||
for x in [1] + ['']:
|
for x in [1] + ['']:
|
||||||
#? int() str()
|
#? int() str()
|
||||||
x
|
x
|
||||||
|
|
||||||
|
# -----------------
|
||||||
|
# For loops with attribute assignment.
|
||||||
|
# -----------------
|
||||||
|
def test_func():
|
||||||
|
x = 'asdf'
|
||||||
|
for x.something in [6,7,8]:
|
||||||
|
pass
|
||||||
|
#? str()
|
||||||
|
x
|
||||||
|
|
||||||
|
for x.something, b in [[6, 6.0]]:
|
||||||
|
pass
|
||||||
|
#? str()
|
||||||
|
x
|
||||||
|
|||||||
Reference in New Issue
Block a user