forked from VimPlug/jedi
finally able to remove stmt.set_vars property
This commit is contained in:
@@ -468,7 +468,7 @@ class Script(object):
|
|||||||
c = user_stmt.get_commands()[0]
|
c = user_stmt.get_commands()[0]
|
||||||
if not isinstance(c, unicode) and self._pos < c.start_pos:
|
if not isinstance(c, unicode) and self._pos < c.start_pos:
|
||||||
# the search_name might be before `=`
|
# the search_name might be before `=`
|
||||||
definitions = [v for v in user_stmt.set_vars
|
definitions = [v for v in user_stmt.get_set_vars()
|
||||||
if unicode(v.names[-1]) == search_name]
|
if unicode(v.names[-1]) == search_name]
|
||||||
if not isinstance(user_stmt, pr.Import):
|
if not isinstance(user_stmt, pr.Import):
|
||||||
# import case is looked at with add_import_name option
|
# import case is looked at with add_import_name option
|
||||||
|
|||||||
@@ -405,7 +405,7 @@ class Parser(object):
|
|||||||
with common.ignored(IndexError, AttributeError):
|
with common.ignored(IndexError, AttributeError):
|
||||||
# If string literal is being parsed
|
# If string literal is being parsed
|
||||||
first_tok = stmt.token_list[0]
|
first_tok = stmt.token_list[0]
|
||||||
if (not stmt.set_vars
|
if (not stmt.get_set_vars()
|
||||||
and not stmt.used_vars
|
and not stmt.used_vars
|
||||||
and len(stmt.token_list) == 1
|
and len(stmt.token_list) == 1
|
||||||
and first_tok[0] == tokenize.STRING):
|
and first_tok[0] == tokenize.STRING):
|
||||||
|
|||||||
@@ -819,10 +819,6 @@ class Statement(Simple):
|
|||||||
search_calls(calls)
|
search_calls(calls)
|
||||||
return self._set_vars + self.as_names
|
return self._set_vars + self.as_names
|
||||||
|
|
||||||
@property
|
|
||||||
def set_vars(self):
|
|
||||||
return self.get_set_vars()
|
|
||||||
|
|
||||||
def is_global(self):
|
def is_global(self):
|
||||||
# first keyword of the first token is global -> must be a global
|
# first keyword of the first token is global -> must be a global
|
||||||
return str(self.token_list[0]) == "global"
|
return str(self.token_list[0]) == "global"
|
||||||
|
|||||||
@@ -191,7 +191,7 @@ def inline(script):
|
|||||||
replace_str = '(%s)' % replace_str
|
replace_str = '(%s)' % replace_str
|
||||||
|
|
||||||
# if it's the only assignment, remove the statement
|
# if it's the only assignment, remove the statement
|
||||||
if len(stmt.set_vars) == 1:
|
if len(stmt.get_set_vars()) == 1:
|
||||||
line = line[:stmt.start_pos[1]] + line[stmt.end_pos[1]:]
|
line = line[:stmt.start_pos[1]] + line[stmt.end_pos[1]:]
|
||||||
|
|
||||||
dct = _rename(inlines, replace_str)
|
dct = _rename(inlines, replace_str)
|
||||||
|
|||||||
Reference in New Issue
Block a user