forked from VimPlug/jedi
Make sure that infering params is possible from the API
This commit is contained in:
@@ -169,6 +169,8 @@ class InferenceState(object):
|
|||||||
return imports.infer_import(context, name)
|
return imports.infer_import(context, name)
|
||||||
if type_ == 'with_stmt':
|
if type_ == 'with_stmt':
|
||||||
return tree_name_to_values(self, context, name)
|
return tree_name_to_values(self, context, name)
|
||||||
|
elif type_ == 'param':
|
||||||
|
return context.py__getattribute__(name.value, position=name.end_pos)
|
||||||
else:
|
else:
|
||||||
result = follow_error_node_imports_if_possible(context, name)
|
result = follow_error_node_imports_if_possible(context, name)
|
||||||
if result is not None:
|
if result is not None:
|
||||||
|
|||||||
@@ -299,6 +299,25 @@ except MyException as e:
|
|||||||
for x in e.my_attr:
|
for x in e.my_attr:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
# -----------------
|
||||||
|
# params
|
||||||
|
# -----------------
|
||||||
|
|
||||||
|
my_param = 1
|
||||||
|
#? 9 str()
|
||||||
|
def foo1(my_param):
|
||||||
|
my_param = 3.0
|
||||||
|
foo1("")
|
||||||
|
|
||||||
|
my_type = float()
|
||||||
|
#? 20 float()
|
||||||
|
def foo2(my_param: my_type):
|
||||||
|
pass
|
||||||
|
foo2("")
|
||||||
|
#? 20 int()
|
||||||
|
def foo3(my_param=my_param):
|
||||||
|
pass
|
||||||
|
foo3("")
|
||||||
|
|
||||||
# -----------------
|
# -----------------
|
||||||
# continuations
|
# continuations
|
||||||
|
|||||||
Reference in New Issue
Block a user