mirror of
https://github.com/davidhalter/jedi.git
synced 2025-12-08 23:04:48 +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:
|
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:
|
|
||||||
stmt = stmt_class(self.module, set_vars, used_vars, tok_list,
|
stmt = stmt_class(self.module, set_vars, used_vars, tok_list,
|
||||||
first_pos, self.end_pos, as_names=as_names)
|
first_pos, self.end_pos, as_names=as_names)
|
||||||
|
|
||||||
stmt.parent = self.top_module
|
stmt.parent = self.top_module
|
||||||
self._check_user_stmt(stmt)
|
self._check_user_stmt(stmt)
|
||||||
|
|
||||||
# Attribute docstring (PEP 224) support (sphinx uses it, e.g.)
|
# TODO somehow this is important here. But it slows down Jedi, remove!
|
||||||
with common.ignored(IndexError, AttributeError):
|
stmt.get_set_vars()
|
||||||
# If string literal is being parsed
|
|
||||||
first_tok = stmt.token_list[0]
|
first_tok = stmt.token_list[0]
|
||||||
if (not stmt.get_set_vars()
|
# Attribute docstring (PEP 224) support (sphinx uses it, e.g.)
|
||||||
and not stmt.used_vars
|
# If string literal is being parsed...
|
||||||
and len(stmt.token_list) == 1
|
if len(stmt.token_list) == 1 \
|
||||||
and first_tok[0] == tokenize.STRING):
|
and not isinstance(first_tok, pr.Name) \
|
||||||
|
and first_tok[0] == tokenize.STRING:
|
||||||
|
with common.ignored(IndexError, AttributeError):
|
||||||
# ... then set it as a docstring
|
# ... then set it as a docstring
|
||||||
self._scope.statements[-1].add_docstr(first_tok[1])
|
self._scope.statements[-1].add_docstr(first_tok[1])
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user