mirror of
https://github.com/davidhalter/jedi.git
synced 2025-12-09 07:14:48 +08:00
fix goto_definition on lambda problem, fixes #274
This commit is contained in:
@@ -1059,6 +1059,8 @@ class Statement(Simple):
|
|||||||
lambd, tok = parse_lambda(token_iterator)
|
lambd, tok = parse_lambda(token_iterator)
|
||||||
if lambd is not None:
|
if lambd is not None:
|
||||||
result.append(lambd)
|
result.append(lambd)
|
||||||
|
else:
|
||||||
|
continue
|
||||||
|
|
||||||
is_literal = token_type in [tokenize.STRING, tokenize.NUMBER]
|
is_literal = token_type in [tokenize.STRING, tokenize.NUMBER]
|
||||||
if isinstance(tok, Name) or is_literal:
|
if isinstance(tok, Name) or is_literal:
|
||||||
|
|||||||
@@ -40,3 +40,7 @@ def test_keyword():
|
|||||||
with common.ignored(jedi.NotFoundError): # TODO shouldn't throw that.
|
with common.ignored(jedi.NotFoundError): # TODO shouldn't throw that.
|
||||||
defs = Script("assert").goto_definitions()
|
defs = Script("assert").goto_definitions()
|
||||||
assert len(defs) == 1
|
assert len(defs) == 1
|
||||||
|
|
||||||
|
def test_lambda():
|
||||||
|
defs = Script('lambda x: x', column=0).goto_definitions()
|
||||||
|
assert [d.type for d in defs] == ['keyword']
|
||||||
|
|||||||
Reference in New Issue
Block a user