remove one more used_vars usage

This commit is contained in:
David Halter
2013-09-02 23:03:21 +04:30
parent afc388e2d7
commit 6ac3cfdece

View File

@@ -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])