mirror of
https://github.com/davidhalter/jedi.git
synced 2025-12-08 23:04:48 +08:00
Param defaults were not correctly followed when goto was used on them.
This commit is contained in:
@@ -468,7 +468,7 @@ class Evaluator(object):
|
|||||||
return helpers.evaluate_call_of_leaf(context, name)
|
return helpers.evaluate_call_of_leaf(context, name)
|
||||||
|
|
||||||
def goto(self, context, name):
|
def goto(self, context, name):
|
||||||
definition = name._get_definition(import_name_always=True)
|
definition = name._get_definition(import_name_always=True) or name
|
||||||
|
|
||||||
par = name.parent
|
par = name.parent
|
||||||
typ = par.type
|
typ = par.type
|
||||||
@@ -501,9 +501,9 @@ class Evaluator(object):
|
|||||||
# Only take the parent, because if it's more complicated than just
|
# Only take the parent, because if it's more complicated than just
|
||||||
# a name it's something you can "goto" again.
|
# a name it's something you can "goto" again.
|
||||||
return [TreeNameDefinition(context, name)]
|
return [TreeNameDefinition(context, name)]
|
||||||
elif typ == 'param' and par.name:
|
elif definition.type == 'param':
|
||||||
return [ParamName(context, name)]
|
return [ParamName(context, name)]
|
||||||
elif typ in ('param', 'funcdef', 'classdef') and par.name is name:
|
elif typ in ('funcdef', 'classdef') and par.name is name:
|
||||||
return [TreeNameDefinition(context, name)]
|
return [TreeNameDefinition(context, name)]
|
||||||
elif isinstance(definition, tree.Import):
|
elif isinstance(definition, tree.Import):
|
||||||
module_names = imports.infer_import(context, name, is_goto=True)
|
module_names = imports.infer_import(context, name, is_goto=True)
|
||||||
|
|||||||
@@ -184,7 +184,7 @@ param = ClassDef
|
|||||||
def ab1(param): pass
|
def ab1(param): pass
|
||||||
#! 9 ['param param']
|
#! 9 ['param param']
|
||||||
def ab2(param): pass
|
def ab2(param): pass
|
||||||
#! 11 ['param a=param']
|
#! 11 ['param = ClassDef']
|
||||||
def ab3(a=param): pass
|
def ab3(a=param): pass
|
||||||
|
|
||||||
ab1(ClassDef);ab2(ClassDef);ab3(ClassDef)
|
ab1(ClassDef);ab2(ClassDef);ab3(ClassDef)
|
||||||
|
|||||||
Reference in New Issue
Block a user