Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(103)

Unified Diff: compiler/java/com/google/dart/compiler/resolver/TopLevelElementBuilder.java

Issue 10134035: Fix a bug that caused private names from an imported library to be included in the name scope of th… (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | compiler/javatests/com/google/dart/compiler/resolver/ResolverTestCase.java » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: compiler/java/com/google/dart/compiler/resolver/TopLevelElementBuilder.java
===================================================================
--- compiler/java/com/google/dart/compiler/resolver/TopLevelElementBuilder.java (revision 6897)
+++ compiler/java/com/google/dart/compiler/resolver/TopLevelElementBuilder.java (working copy)
@@ -76,30 +76,36 @@
libraryPrefixElement.addLibrary(lib.getElement());
// Fill library prefix scope.
for (DartUnit unit : lib.getUnits()) {
- fillInUnitScope(unit, listener, libraryPrefixElement.getScope());
+ fillInUnitScope(unit, listener, libraryPrefixElement.getScope(), false);
}
} else {
// Put the elements of the library in the scope.
for (DartUnit unit : lib.getUnits()) {
- fillInUnitScope(unit, listener, scope);
+ fillInUnitScope(unit, listener, scope, false);
}
}
}
for (DartUnit unit : library.getUnits()) {
- fillInUnitScope(unit, listener, scope);
+ fillInUnitScope(unit, listener, scope, true);
}
}
@VisibleForTesting
- void fillInUnitScope(DartUnit unit, DartCompilerListener listener, Scope scope) {
+ void fillInUnitScope(DartUnit unit, DartCompilerListener listener, Scope scope, boolean includePrivate) {
for (DartNode node : unit.getTopLevelNodes()) {
if (node instanceof DartFieldDefinition) {
for (DartField field : ((DartFieldDefinition) node).getFields()) {
- declare(field.getElement(), listener, scope);
+ Element element = field.getElement();
+ if (includePrivate || !element.getName().startsWith("_")) {
scheglov 2012/04/24 18:32:11 May be use com.google.dart.compiler.ast.DartIdenti
Brian Wilkerson 2012/04/24 18:47:24 Done
+ declare(element, listener, scope);
scheglov 2012/04/24 18:32:11 indentation
Brian Wilkerson 2012/04/24 18:47:24 Done
+ }
}
} else {
- declare((Element) node.getElement(), listener, scope);
+ Element element = node.getElement();
+ if (includePrivate || !element.getName().startsWith("_")) {
+ declare(element, listener, scope);
+ }
}
}
}
« no previous file with comments | « no previous file | compiler/javatests/com/google/dart/compiler/resolver/ResolverTestCase.java » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698