1
0
forked from VimPlug/jedi

Small cleanup: Dynamic params comparison works now with the evaluator functions.

This commit is contained in:
Dave Halter
2014-11-18 13:28:24 +01:00
parent 78b7b8ffaf
commit 6d866eb915
2 changed files with 8 additions and 8 deletions

View File

@@ -88,13 +88,13 @@ def search_params(evaluator, param):
if trailer is not None: if trailer is not None:
types = evaluator.goto_definition(name) types = evaluator.goto_definition(name)
# TODO why not a direct comparison? functions seem to be # We have to remove decorators, because they are not the
# decorated in types and not in compare... # "original" functions, this way we can easily compare.
undecorated = [escope.decorates or escope for escope in types # At the same time we also have to remove InstanceElements.
if escope.isinstance(er.Function, er.Class)] undec = [escope.decorates or
c = [getattr(escope, 'base_func', None) or escope.base (escope.var if isinstance(escope, er.InstanceElement) else escope)
for escope in undecorated] for escope in types if escope.isinstance(er.Function, er.Class)]
if compare in c: if er.wrap(evaluator, compare) in undec:
# Only if we have the correct function we execute # Only if we have the correct function we execute
# it, otherwise just ignore it. # it, otherwise just ignore it.
evaluator.eval_trailer(types, trailer) evaluator.eval_trailer(types, trailer)

View File

@@ -504,7 +504,7 @@ class Function(use_metaclass(CachedMetaClass, Wrapper)):
debug.dbg('decorator end %s', f) debug.dbg('decorator end %s', f)
if isinstance(f, pr.Function): if isinstance(f, pr.Function):
f = Function(self._evaluator, f, True) return self
return f return f
def get_decorated_func(self): def get_decorated_func(self):