1
0
forked from VimPlug/jedi

can now refactor statements ahead of '=', fixes #20

This commit is contained in:
David Halter
2012-09-23 14:19:47 +02:00
parent 111f7c637f
commit 56a97c9df5
3 changed files with 10 additions and 4 deletions

View File

@@ -328,8 +328,14 @@ class Script(object):
TODO implement additional_module_paths
"""
user_stmt = self.parser.user_stmt
definitions, search_name = self._goto(add_import_name=True)
if not isinstance(self.parser.user_stmt, parsing.Import):
if isinstance(user_stmt, parsing.Statement) \
and self.pos < user_stmt.get_assignment_calls().start_pos:
# the search_name might be before `=`
definitions = [v for v in user_stmt.set_vars
if str(v) == search_name]
if not isinstance(user_stmt, parsing.Import):
# import case is looked at with add_import_name option
definitions = dynamic.related_name_add_import_modules(definitions,
search_name)

View File

@@ -1373,9 +1373,9 @@ def follow_call_list(call_list):
# comprehensions
result += follow_statement(stmt)
else:
# With things like params, these can also be functions...
if isinstance(call, (Function, Class, Instance,
dynamic.ArrayInstance)):
# With things like params, these can also be functions...
result.append(call)
# The string tokens are just operations (+, -, etc.)
elif not isinstance(call, str):

View File

@@ -90,8 +90,8 @@ from import_tree.rename1 import not_existing
response = 3
#< 0 (95, 0), (96, 0), (97, 0), (99, 0)
response = HttpResponse(mimetype='application/pdf')
response['Content-Disposition'] = 'attachment; filename=%s.pdf' % id
response.write(pdf)