mirror of
https://github.com/davidhalter/jedi.git
synced 2025-12-07 14:34:31 +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
|
||||
: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',
|
||||
'docstr')
|
||||
|
||||
def __init__(self, module, set_vars, used_vars, token_list,
|
||||
start_pos, end_pos, parent=None, as_names=(), set_name_parents=True):
|
||||
super(Statement, self).__init__(module, start_pos, end_pos)
|
||||
self.used_vars = used_vars
|
||||
self._used_vars = used_vars
|
||||
self.token_list = token_list
|
||||
if set_name_parents:
|
||||
for t in token_list:
|
||||
@@ -782,6 +782,10 @@ class Statement(Simple):
|
||||
self._assignment_details = []
|
||||
# this is important for other scripts
|
||||
|
||||
@property
|
||||
def used_vars(self):
|
||||
return self._used_vars
|
||||
|
||||
def add_docstr(self, string):
|
||||
""" Clean up a docstring """
|
||||
self.docstr = cleandoc(literal_eval(string))
|
||||
@@ -949,9 +953,8 @@ class Statement(Simple):
|
||||
if not token_list:
|
||||
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)
|
||||
statement.used_vars = used_vars
|
||||
return statement, tok
|
||||
|
||||
def parse_lambda(token_iterator):
|
||||
|
||||
Reference in New Issue
Block a user