mirror of
https://github.com/davidhalter/jedi.git
synced 2025-12-07 14:34:31 +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):
|
if name.is_definition() and self._access_possible(name):
|
||||||
yield name
|
yield name
|
||||||
continue
|
continue
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
init_execution = self.context.get_init_function()
|
init_execution = self.context.get_init_function()
|
||||||
# Hopefully we can somehow change this.
|
# Hopefully we can somehow change this.
|
||||||
if init_execution is not None and \
|
if init_execution is not None and \
|
||||||
|
|||||||
@@ -208,6 +208,17 @@ class ClassContext(use_metaclass(CachedMetaClass, context.TreeContext)):
|
|||||||
return names
|
return names
|
||||||
return []
|
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
|
@property
|
||||||
def name(self):
|
def name(self):
|
||||||
return ContextName(self, self.classdef.name)
|
return ContextName(self, self.classdef.name)
|
||||||
@@ -277,12 +288,8 @@ class FunctionContext(use_metaclass(CachedMetaClass, context.TreeContext)):
|
|||||||
return ContextName(self, self.funcdef.name)
|
return ContextName(self, self.funcdef.name)
|
||||||
|
|
||||||
def get_param_names(self):
|
def get_param_names(self):
|
||||||
anon = AnonymousFunctionExecution(
|
function_execution = self.get_function_execution()
|
||||||
self.evaluator,
|
return [ParamName(function_execution, param.name) for param in self.funcdef.params]
|
||||||
self.parent_context,
|
|
||||||
self
|
|
||||||
)
|
|
||||||
return [ParamName(anon, param.name) for param in self.funcdef.params]
|
|
||||||
|
|
||||||
|
|
||||||
class FunctionExecutionContext(Executed):
|
class FunctionExecutionContext(Executed):
|
||||||
|
|||||||
Reference in New Issue
Block a user