mirror of
https://github.com/davidhalter/jedi.git
synced 2026-08-31 02:26:56 +08:00
removed merged Statement.used_funcs and used_vars (made no sense)
This commit is contained in:
@@ -508,7 +508,7 @@ class Execution(Executable):
|
|||||||
arr.values = values
|
arr.values = values
|
||||||
key_stmts = []
|
key_stmts = []
|
||||||
for key in keys:
|
for key in keys:
|
||||||
stmt = pr.Statement(self._sub_module, [], [], [], [],
|
stmt = pr.Statement(self._sub_module, [], [], [],
|
||||||
start_pos, None)
|
start_pos, None)
|
||||||
stmt._commands = [key]
|
stmt._commands = [key]
|
||||||
key_stmts.append(stmt)
|
key_stmts.append(stmt)
|
||||||
@@ -624,7 +624,7 @@ class Execution(Executable):
|
|||||||
old = stmt
|
old = stmt
|
||||||
# generate a statement if it's not already one.
|
# generate a statement if it's not already one.
|
||||||
module = builtin.Builtin.scope
|
module = builtin.Builtin.scope
|
||||||
stmt = pr.Statement(module, [], [], [], [], (0, 0), None)
|
stmt = pr.Statement(module, [], [], [], (0, 0), None)
|
||||||
stmt._commands = [old]
|
stmt._commands = [old]
|
||||||
|
|
||||||
# *args
|
# *args
|
||||||
|
|||||||
+5
-10
@@ -312,7 +312,6 @@ class Parser(object):
|
|||||||
:rtype: (Statement, str)
|
:rtype: (Statement, str)
|
||||||
"""
|
"""
|
||||||
set_vars = []
|
set_vars = []
|
||||||
used_funcs = []
|
|
||||||
used_vars = []
|
used_vars = []
|
||||||
level = 0 # The level of parentheses
|
level = 0 # The level of parentheses
|
||||||
|
|
||||||
@@ -421,7 +420,7 @@ class Parser(object):
|
|||||||
i = 0
|
i = 0
|
||||||
|
|
||||||
tok_list, toks = tok_list[:-i], tok_list[-i:-1]
|
tok_list, toks = tok_list[:-i], tok_list[-i:-1]
|
||||||
st = pr.Statement(self.module, [], [], [],
|
st = pr.Statement(self.module, [], [],
|
||||||
toks, first_pos, self.end_pos)
|
toks, first_pos, self.end_pos)
|
||||||
|
|
||||||
tok = pr.ListComprehension(st, middle, in_clause,
|
tok = pr.ListComprehension(st, middle, in_clause,
|
||||||
@@ -434,11 +433,7 @@ class Parser(object):
|
|||||||
tok_list.pop()
|
tok_list.pop()
|
||||||
if n:
|
if n:
|
||||||
tok_list.append(n)
|
tok_list.append(n)
|
||||||
if tok == '(':
|
used_vars.append(n)
|
||||||
# it must be a function
|
|
||||||
used_funcs.append(n)
|
|
||||||
else:
|
|
||||||
used_vars.append(n)
|
|
||||||
continue
|
continue
|
||||||
elif tok.endswith('=') and tok not in ['>=', '<=', '==', '!=']:
|
elif tok.endswith('=') and tok not in ['>=', '<=', '==', '!=']:
|
||||||
# there has been an assignement -> change vars
|
# there has been an assignement -> change vars
|
||||||
@@ -457,14 +452,14 @@ class Parser(object):
|
|||||||
|
|
||||||
if not tok_list:
|
if not tok_list:
|
||||||
return None, tok
|
return None, tok
|
||||||
#print 'new_stat', set_vars, used_funcs, used_vars
|
#print 'new_stat', set_vars, used_vars
|
||||||
if self.freshscope and not self.no_docstr and len(tok_list) == 1 \
|
if self.freshscope and not self.no_docstr and len(tok_list) == 1 \
|
||||||
and self.last_token[0] == tokenize.STRING:
|
and self.last_token[0] == tokenize.STRING:
|
||||||
self.scope.add_docstr(self.last_token[1])
|
self.scope.add_docstr(self.last_token[1])
|
||||||
return None, tok
|
return None, tok
|
||||||
else:
|
else:
|
||||||
stmt = stmt_class(self.module, set_vars, used_funcs,
|
stmt = stmt_class(self.module, set_vars, used_vars, tok_list,
|
||||||
used_vars, tok_list, first_pos, self.end_pos)
|
first_pos, self.end_pos)
|
||||||
|
|
||||||
self._check_user_stmt(stmt)
|
self._check_user_stmt(stmt)
|
||||||
|
|
||||||
|
|||||||
@@ -651,8 +651,6 @@ class Statement(Simple):
|
|||||||
|
|
||||||
:param set_vars: The variables which are defined by the statement.
|
:param set_vars: The variables which are defined by the statement.
|
||||||
:param set_vars: str
|
:param set_vars: str
|
||||||
:param used_funcs: The functions which are used by the statement.
|
|
||||||
:param used_funcs: str
|
|
||||||
:param used_vars: The variables which are used by the statement.
|
:param used_vars: The variables which are used by the statement.
|
||||||
:param used_vars: str
|
:param used_vars: str
|
||||||
:param token_list: Token list which is also peppered with Name.
|
:param token_list: Token list which is also peppered with Name.
|
||||||
@@ -660,16 +658,15 @@ class Statement(Simple):
|
|||||||
:param start_pos: Position (line, column) of the Statement.
|
:param start_pos: Position (line, column) of the Statement.
|
||||||
:type start_pos: tuple(int, int)
|
:type start_pos: tuple(int, int)
|
||||||
"""
|
"""
|
||||||
__slots__ = ('used_funcs', 'token_list', 'used_vars',
|
__slots__ = ('token_list', 'used_vars',
|
||||||
'set_vars', '_commands', '_assignment_details')
|
'set_vars', '_commands', '_assignment_details')
|
||||||
|
|
||||||
def __init__(self, module, set_vars, used_funcs, used_vars,
|
def __init__(self, module, set_vars, used_vars, token_list,
|
||||||
token_list, start_pos, end_pos, parent=None):
|
start_pos, end_pos, parent=None):
|
||||||
super(Statement, self).__init__(module, start_pos, end_pos)
|
super(Statement, self).__init__(module, start_pos, end_pos)
|
||||||
self.used_funcs = used_funcs
|
|
||||||
self.used_vars = used_vars
|
self.used_vars = used_vars
|
||||||
self.token_list = token_list
|
self.token_list = token_list
|
||||||
for s in set_vars + used_funcs + used_vars:
|
for s in set_vars + used_vars:
|
||||||
s.parent = self.use_as_parent
|
s.parent = self.use_as_parent
|
||||||
self.set_vars = self._remove_executions_from_set_vars(set_vars)
|
self.set_vars = self._remove_executions_from_set_vars(set_vars)
|
||||||
self.parent = parent
|
self.parent = parent
|
||||||
@@ -842,7 +839,7 @@ class Statement(Simple):
|
|||||||
if not token_list:
|
if not token_list:
|
||||||
return None, tok
|
return None, tok
|
||||||
|
|
||||||
statement = Statement(self._sub_module, [], [], [],
|
statement = Statement(self._sub_module, [], [],
|
||||||
token_list, start_pos, end_pos)
|
token_list, start_pos, end_pos)
|
||||||
statement.parent = self.parent
|
statement.parent = self.parent
|
||||||
return statement, tok
|
return statement, tok
|
||||||
@@ -927,10 +924,10 @@ class Param(Statement):
|
|||||||
__slots__ = ('position_nr', 'is_generated', 'annotation_stmt',
|
__slots__ = ('position_nr', 'is_generated', 'annotation_stmt',
|
||||||
'parent_function')
|
'parent_function')
|
||||||
|
|
||||||
def __init__(self, module, set_vars, used_funcs, used_vars,
|
def __init__(self, module, set_vars, used_vars, token_list,
|
||||||
token_list, start_pos, end_pos):
|
start_pos, end_pos):
|
||||||
super(Param, self).__init__(module, set_vars, used_funcs,
|
super(Param, self).__init__(module, set_vars, used_vars, token_list,
|
||||||
used_vars, token_list, start_pos, end_pos)
|
start_pos, end_pos)
|
||||||
|
|
||||||
# this is defined by the parser later on, not at the initialization
|
# this is defined by the parser later on, not at the initialization
|
||||||
# it is the position in the call (first argument, second...)
|
# it is the position in the call (first argument, second...)
|
||||||
|
|||||||
Reference in New Issue
Block a user