mirror of
https://github.com/davidhalter/jedi.git
synced 2025-12-06 14:04:26 +08:00
invalid goto syntax
This commit is contained in:
@@ -389,9 +389,9 @@ class Script(object):
|
||||
defs, search_name = evaluate.goto(stmt)
|
||||
definitions = follow_inexistent_imports(defs)
|
||||
if isinstance(user_stmt, pr.Statement):
|
||||
call = user_stmt.get_commands()[0]
|
||||
if not isinstance(call, (str, unicode)) and \
|
||||
call.start_pos > self.pos:
|
||||
c = user_stmt.get_commands()
|
||||
if c and not isinstance(c[0], (str, unicode)) and \
|
||||
c[0].start_pos > self.pos:
|
||||
# The cursor must be after the start, otherwise the
|
||||
# statement is just an assignee.
|
||||
definitions = [user_stmt]
|
||||
|
||||
@@ -795,6 +795,8 @@ def filter_private_variable(scope, call_scope, var_name):
|
||||
def goto(stmt, call_path=None):
|
||||
if call_path is None:
|
||||
commands = stmt.get_commands()
|
||||
if len(commands) == 0:
|
||||
return [], ''
|
||||
# Only the first command is important, the rest should basically not
|
||||
# happen except in broken code (e.g. docstrings that aren't code).
|
||||
call = commands[0]
|
||||
|
||||
@@ -119,4 +119,11 @@ def asdf(a or b): # multiple param names
|
||||
#? int()
|
||||
asdf(2)
|
||||
|
||||
# -----------------
|
||||
# goto
|
||||
# -----------------
|
||||
|
||||
#! []
|
||||
as
|
||||
|
||||
import datetime as
|
||||
|
||||
Reference in New Issue
Block a user