Because of the change in dynamic params, we can now remove the decorator hack in the name finder.

This commit is contained in:
Dave Halter
2014-11-18 13:06:20 +01:00
parent f9276a8bd2
commit 93ffc799f5
2 changed files with 6 additions and 6 deletions
+2 -2
View File
@@ -100,7 +100,7 @@ class Evaluator(object):
self.analysis = [] self.analysis = []
def find_types(self, scope, name_str, position=None, search_global=False, def find_types(self, scope, name_str, position=None, search_global=False,
is_goto=False, resolve_decorator=True): is_goto=False):
""" """
This is the search function. The most important part to debug. This is the search function. The most important part to debug.
`remove_statements` and `filter_statements` really are the core part of `remove_statements` and `filter_statements` really are the core part of
@@ -113,7 +113,7 @@ class Evaluator(object):
scopes = f.scopes(search_global) scopes = f.scopes(search_global)
if is_goto: if is_goto:
return f.filter_name(scopes) return f.filter_name(scopes)
return f.find(scopes, resolve_decorator, search_global) return f.find(scopes, search_global)
@memoize_default(default=[], evaluator_is_first_arg=True) @memoize_default(default=[], evaluator_is_first_arg=True)
@recursion.recursion_decorator @recursion.recursion_decorator
+4 -4
View File
@@ -37,9 +37,9 @@ class NameFinder(object):
self.position = position self.position = position
@debug.increase_indent @debug.increase_indent
def find(self, scopes, resolve_decorator=True, search_global=False): def find(self, scopes, search_global=False):
names = self.filter_name(scopes, search_global) names = self.filter_name(scopes, search_global)
types = self._names_to_types(names, resolve_decorator) types = self._names_to_types(names)
if not names and not types \ if not names and not types \
and not (isinstance(self.name_str, pr.Name) and not (isinstance(self.name_str, pr.Name)
@@ -274,7 +274,7 @@ class NameFinder(object):
return True return True
return False return False
def _names_to_types(self, names, resolve_decorator): def _names_to_types(self, names):
types = [] types = []
evaluator = self._evaluator evaluator = self._evaluator
@@ -319,7 +319,7 @@ class NameFinder(object):
types = list(chain.from_iterable( types = list(chain.from_iterable(
evaluator.execute(t) for t in exceptions)) evaluator.execute(t) for t in exceptions))
else: else:
if typ.isinstance(er.Function) and resolve_decorator: if typ.isinstance(er.Function):
typ = typ.get_decorated_func() typ = typ.get_decorated_func()
types.append(typ) types.append(typ)