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,
first_pos, self.end_pos, as_names=as_names)
stmt.parent = self.top_module stmt = stmt_class(self.module, set_vars, used_vars, tok_list,
self._check_user_stmt(stmt) first_pos, self.end_pos, as_names=as_names)
stmt.parent = self.top_module
self._check_user_stmt(stmt)
# TODO somehow this is important here. But it slows down Jedi, remove!
stmt.get_set_vars()
first_tok = stmt.token_list[0]
# Attribute docstring (PEP 224) support (sphinx uses it, e.g.) # Attribute docstring (PEP 224) support (sphinx uses it, e.g.)
with common.ignored(IndexError, AttributeError): # If string literal is being parsed...
# If string literal is being parsed if len(stmt.token_list) == 1 \
first_tok = stmt.token_list[0] and not isinstance(first_tok, pr.Name) \
if (not stmt.get_set_vars() and first_tok[0] == tokenize.STRING:
and not stmt.used_vars with common.ignored(IndexError, AttributeError):
and len(stmt.token_list) == 1
and first_tok[0] == tokenize.STRING):
# ... 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])