forked from VimPlug/jedi
Simplify some more call signature things
This commit is contained in:
@@ -345,12 +345,11 @@ class Script(object):
|
||||
)
|
||||
debug.speed('func_call followed')
|
||||
|
||||
return [classes.CallSignature(signature._context, signature,
|
||||
return [classes.CallSignature(self._evaluator, signature,
|
||||
call_signature_details.bracket_leaf.start_pos,
|
||||
call_signature_details.call_index,
|
||||
call_signature_details.keyword_name_str)
|
||||
for definition in definitions
|
||||
for signature in definition.get_signatures()]
|
||||
for signature in definitions.get_signatures()]
|
||||
|
||||
def _analysis(self):
|
||||
self._evaluator.is_analysis = True
|
||||
|
||||
@@ -574,8 +574,8 @@ class CallSignature(Definition):
|
||||
It knows what functions you are currently in. e.g. `isinstance(` would
|
||||
return the `isinstance` function. without `(` it would return nothing.
|
||||
"""
|
||||
def __init__(self, definition, signature, bracket_start_pos, index, key_name_str):
|
||||
super(CallSignature, self).__init__(definition.evaluator, definition.name)
|
||||
def __init__(self, evaluator, signature, bracket_start_pos, index, key_name_str):
|
||||
super(CallSignature, self).__init__(evaluator, signature.name)
|
||||
self._index = index
|
||||
self._key_name_str = key_name_str
|
||||
self._bracket_start_pos = bracket_start_pos
|
||||
|
||||
@@ -8,7 +8,7 @@ class AbstractSignature(object):
|
||||
|
||||
@abstractproperty
|
||||
def name(self):
|
||||
raise NotImplementedError
|
||||
return self._context.name
|
||||
|
||||
def annotation(self):
|
||||
return None
|
||||
@@ -31,18 +31,6 @@ class TreeSignature(AbstractSignature):
|
||||
super(TreeSignature, self).__init__(context, is_bound)
|
||||
self._function_context = function_context or context
|
||||
|
||||
@property
|
||||
def name(self):
|
||||
name = self._function_context.name
|
||||
if name.string_name == '__init__':
|
||||
try:
|
||||
class_context = self._function_context.class_context
|
||||
except AttributeError:
|
||||
pass
|
||||
else:
|
||||
return class_context.name
|
||||
return name
|
||||
|
||||
def bind(self, context):
|
||||
return TreeSignature(context, self._function_context, is_bound=True)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user