mirror of
https://github.com/davidhalter/jedi.git
synced 2025-12-08 23:04:48 +08:00
fix a problem related to #246: comments were used as normal strings
This commit is contained in:
@@ -791,7 +791,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()
|
||||||
assert len(commands) == 1
|
# 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]
|
call = commands[0]
|
||||||
if isinstance(call, (str, unicode)):
|
if isinstance(call, (str, unicode)):
|
||||||
call_path = [call]
|
call_path = [call]
|
||||||
|
|||||||
@@ -1114,7 +1114,7 @@ class Statement(Simple):
|
|||||||
result = []
|
result = []
|
||||||
is_chain = False
|
is_chain = False
|
||||||
else:
|
else:
|
||||||
if tok != '\n':
|
if tok != '\n' and token_type != tokenize.COMMENT:
|
||||||
result.append(tok)
|
result.append(tok)
|
||||||
return result
|
return result
|
||||||
|
|
||||||
|
|||||||
@@ -220,3 +220,14 @@ class B(): pass
|
|||||||
A.__init__
|
A.__init__
|
||||||
#? ['__init__']
|
#? ['__init__']
|
||||||
B.__init__
|
B.__init__
|
||||||
|
|
||||||
|
|
||||||
|
# -----------------
|
||||||
|
# comments
|
||||||
|
# -----------------
|
||||||
|
|
||||||
|
class A():
|
||||||
|
def __init__(self):
|
||||||
|
self.hello = {} # comment shouldn't be a string
|
||||||
|
#? dict()
|
||||||
|
A().hello
|
||||||
|
|||||||
Reference in New Issue
Block a user