mirror of
https://github.com/davidhalter/jedi.git
synced 2025-12-07 22:44:27 +08:00
move also used_vars to a property, to show that it's not being written to
This commit is contained in:
@@ -757,14 +757,14 @@ class Statement(Simple):
|
|||||||
:type start_pos: 2-tuple of int
|
:type start_pos: 2-tuple of int
|
||||||
:param start_pos: Position (line, column) of the Statement.
|
:param start_pos: Position (line, column) of the Statement.
|
||||||
"""
|
"""
|
||||||
__slots__ = ('token_list', 'used_vars',
|
__slots__ = ('token_list', '_used_vars',
|
||||||
'_set_vars', 'as_names', '_commands', '_assignment_details',
|
'_set_vars', 'as_names', '_commands', '_assignment_details',
|
||||||
'docstr')
|
'docstr')
|
||||||
|
|
||||||
def __init__(self, module, set_vars, used_vars, token_list,
|
def __init__(self, module, set_vars, used_vars, token_list,
|
||||||
start_pos, end_pos, parent=None, as_names=(), set_name_parents=True):
|
start_pos, end_pos, parent=None, as_names=(), set_name_parents=True):
|
||||||
super(Statement, self).__init__(module, start_pos, end_pos)
|
super(Statement, self).__init__(module, start_pos, end_pos)
|
||||||
self.used_vars = used_vars
|
self._used_vars = used_vars
|
||||||
self.token_list = token_list
|
self.token_list = token_list
|
||||||
if set_name_parents:
|
if set_name_parents:
|
||||||
for t in token_list:
|
for t in token_list:
|
||||||
@@ -782,6 +782,10 @@ class Statement(Simple):
|
|||||||
self._assignment_details = []
|
self._assignment_details = []
|
||||||
# this is important for other scripts
|
# this is important for other scripts
|
||||||
|
|
||||||
|
@property
|
||||||
|
def used_vars(self):
|
||||||
|
return self._used_vars
|
||||||
|
|
||||||
def add_docstr(self, string):
|
def add_docstr(self, string):
|
||||||
""" Clean up a docstring """
|
""" Clean up a docstring """
|
||||||
self.docstr = cleandoc(literal_eval(string))
|
self.docstr = cleandoc(literal_eval(string))
|
||||||
@@ -949,9 +953,8 @@ class Statement(Simple):
|
|||||||
if not token_list:
|
if not token_list:
|
||||||
return None, tok
|
return None, tok
|
||||||
|
|
||||||
statement = stmt_class(self._sub_module, [], [], token_list,
|
statement = stmt_class(self._sub_module, [], used_vars, token_list,
|
||||||
start_pos, end_pos, self.parent, set_name_parents=False)
|
start_pos, end_pos, self.parent, set_name_parents=False)
|
||||||
statement.used_vars = used_vars
|
|
||||||
return statement, tok
|
return statement, tok
|
||||||
|
|
||||||
def parse_lambda(token_iterator):
|
def parse_lambda(token_iterator):
|
||||||
|
|||||||
Reference in New Issue
Block a user