mirror of
https://github.com/davidhalter/jedi.git
synced 2025-12-08 14:54:47 +08:00
remove one more used_vars usage
This commit is contained in:
@@ -394,21 +394,23 @@ class Parser(object):
|
||||
and self.last_token[0] == tokenize.STRING:
|
||||
self._scope.add_docstr(self.last_token[1])
|
||||
return None, tok
|
||||
else:
|
||||
|
||||
stmt = stmt_class(self.module, set_vars, used_vars, tok_list,
|
||||
first_pos, self.end_pos, as_names=as_names)
|
||||
|
||||
stmt.parent = self.top_module
|
||||
self._check_user_stmt(stmt)
|
||||
|
||||
# Attribute docstring (PEP 224) support (sphinx uses it, e.g.)
|
||||
with common.ignored(IndexError, AttributeError):
|
||||
# If string literal is being parsed
|
||||
# TODO somehow this is important here. But it slows down Jedi, remove!
|
||||
stmt.get_set_vars()
|
||||
|
||||
first_tok = stmt.token_list[0]
|
||||
if (not stmt.get_set_vars()
|
||||
and not stmt.used_vars
|
||||
and len(stmt.token_list) == 1
|
||||
and first_tok[0] == tokenize.STRING):
|
||||
# Attribute docstring (PEP 224) support (sphinx uses it, e.g.)
|
||||
# If string literal is being parsed...
|
||||
if len(stmt.token_list) == 1 \
|
||||
and not isinstance(first_tok, pr.Name) \
|
||||
and first_tok[0] == tokenize.STRING:
|
||||
with common.ignored(IndexError, AttributeError):
|
||||
# ... then set it as a docstring
|
||||
self._scope.statements[-1].add_docstr(first_tok[1])
|
||||
|
||||
|
||||
Reference in New Issue
Block a user