| Index: editor/tools/plugins/com.google.dart.engine/src/com/google/dart/engine/internal/scope/EnclosedScope.java
|
| diff --git a/editor/tools/plugins/com.google.dart.engine/src/com/google/dart/engine/internal/scope/EnclosedScope.java b/editor/tools/plugins/com.google.dart.engine/src/com/google/dart/engine/internal/scope/EnclosedScope.java
|
| index 1824161621361266572b9a33b98f8749a0e21ee7..449c83b13c3a841047a45900a4ee0e55e5c8523f 100644
|
| --- a/editor/tools/plugins/com.google.dart.engine/src/com/google/dart/engine/internal/scope/EnclosedScope.java
|
| +++ b/editor/tools/plugins/com.google.dart.engine/src/com/google/dart/engine/internal/scope/EnclosedScope.java
|
| @@ -18,6 +18,9 @@ import com.google.dart.engine.element.Element;
|
| import com.google.dart.engine.element.LibraryElement;
|
| import com.google.dart.engine.error.AnalysisErrorListener;
|
|
|
| +import java.util.HashSet;
|
| +import java.util.Set;
|
| +
|
| /**
|
| * Instances of the class {@code EnclosedScope} implement a scope that is lexically enclosed in
|
| * another scope.
|
| @@ -31,6 +34,13 @@ public class EnclosedScope extends Scope {
|
| private Scope enclosingScope;
|
|
|
| /**
|
| + * A set of names that will be defined in this scope, but right now are not defined. However
|
| + * according to the scoping rules these names are hidden, even if they were defined in an outer
|
| + * scope.
|
| + */
|
| + private Set<String> hiddenNames = new HashSet<String>();
|
| +
|
| + /**
|
| * Initialize a newly created scope enclosed within another scope.
|
| *
|
| * @param enclosingScope the scope in which this scope is lexically enclosed
|
| @@ -50,6 +60,21 @@ public class EnclosedScope extends Scope {
|
| }
|
|
|
| /**
|
| + * Hides the name of the given element in this scope. If there is already an element with the
|
| + * given name defined in an outer scope, then it will become unavailable.
|
| + *
|
| + * @param element the element to be hidden in this scope
|
| + */
|
| + public void hide(Element element) {
|
| + if (element != null) {
|
| + String name = element.getName();
|
| + if (name != null && !name.isEmpty()) {
|
| + hiddenNames.add(name);
|
| + }
|
| + }
|
| + }
|
| +
|
| + /**
|
| * Return the scope in which this scope is lexically enclosed.
|
| *
|
| * @return the scope in which this scope is lexically enclosed
|
| @@ -64,6 +89,9 @@ public class EnclosedScope extends Scope {
|
| if (element != null) {
|
| return element;
|
| }
|
| + if (hiddenNames.contains(name)) {
|
| + return null;
|
| + }
|
| return enclosingScope.lookup(identifier, name, referencingLibrary);
|
| }
|
| }
|
|
|