mirror of
https://github.com/davidhalter/jedi.git
synced 2025-12-06 22:14:27 +08:00
Fix displaying param names for classes.
This commit is contained in:
@@ -366,6 +366,11 @@ class SelfNameFilter(InstanceClassFilter):
|
||||
if name.is_definition() and self._access_possible(name):
|
||||
yield name
|
||||
continue
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
init_execution = self.context.get_init_function()
|
||||
# Hopefully we can somehow change this.
|
||||
if init_execution is not None and \
|
||||
|
||||
@@ -208,6 +208,17 @@ class ClassContext(use_metaclass(CachedMetaClass, context.TreeContext)):
|
||||
return names
|
||||
return []
|
||||
|
||||
def get_param_names(self):
|
||||
for name in self.get_function_slot_names('__init__'):
|
||||
for context_ in name.infer():
|
||||
try:
|
||||
method = context_.get_param_names
|
||||
except AttributeError:
|
||||
pass
|
||||
else:
|
||||
return method()[:-1]
|
||||
return []
|
||||
|
||||
@property
|
||||
def name(self):
|
||||
return ContextName(self, self.classdef.name)
|
||||
@@ -277,12 +288,8 @@ class FunctionContext(use_metaclass(CachedMetaClass, context.TreeContext)):
|
||||
return ContextName(self, self.funcdef.name)
|
||||
|
||||
def get_param_names(self):
|
||||
anon = AnonymousFunctionExecution(
|
||||
self.evaluator,
|
||||
self.parent_context,
|
||||
self
|
||||
)
|
||||
return [ParamName(anon, param.name) for param in self.funcdef.params]
|
||||
function_execution = self.get_function_execution()
|
||||
return [ParamName(function_execution, param.name) for param in self.funcdef.params]
|
||||
|
||||
|
||||
class FunctionExecutionContext(Executed):
|
||||
|
||||
Reference in New Issue
Block a user