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