fix the CallSignature.index attribute

This commit is contained in:
Dave Halter
2014-05-04 23:36:24 +02:00
parent a4b9ccc2e7
commit f2af053a4a
4 changed files with 57 additions and 22 deletions
+19 -3
View File
@@ -682,12 +682,28 @@ 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, evaluator, executable, call, index):
def __init__(self, evaluator, executable, call, index, key_name):
super(CallSignature, self).__init__(evaluator, executable)
self.index = index
""" The param index of the current call. """
self._index = index
self._key_name = key_name
self._call = call
@property
def index(self):
"""
The Param index of the current call.
Returns None if the index doesn't is not defined.
"""
if self._key_name is not None:
for i, param in enumerate(self.params):
if self._key_name == param.name:
return i
return None
if self._index >= len(self.params):
return None
return self._index
@property
def bracket_start(self):
"""