Get lambdas mostly working.

This commit is contained in:
Dave Halter
2014-12-01 02:47:48 +01:00
parent 4ee5ad4ce3
commit 88853c78f4
5 changed files with 61 additions and 34 deletions
+6 -2
View File
@@ -74,9 +74,12 @@ class NameFinder(object):
except KeyError:
return []
if isinstance(scope, pr.CompFor):
if isinstance(scope, (pr.CompFor, pr.Lambda)):
return names
names = pr.filter_after_position(names, position)
if not (isinstance(scope, er.FunctionExecution)
and isinstance(scope.base, er.LambdaWrapper)):
names = pr.filter_after_position(names, position)
names = [name for name in names if name.is_definition()]
# Only the names defined in the last position are valid definitions.
@@ -539,6 +542,7 @@ def get_names_of_scope(evaluator, scope, position=None, star_search=True, includ
if isinstance(scope, pr.SubModule) and scope.parent or not scope.is_scope():
scope = scope.parent
continue
# `pr.Class` is used, because the parent is never `Class`.
# Ignore the Flows, because the classes and functions care for that.
# InstanceElement of Class is ignored, if it is not the start scope.