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

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

Issue 10827469: Issue 4641. Resolve 'part of' to LibraryElement (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 4 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
Index: compiler/java/com/google/dart/compiler/resolver/TopLevelElementBuilder.java
diff --git a/compiler/java/com/google/dart/compiler/resolver/TopLevelElementBuilder.java b/compiler/java/com/google/dart/compiler/resolver/TopLevelElementBuilder.java
index 0d27719262251537564ad6bd3a10ff37dc8d1514..b07dab62454b4333af8959990ddbed43cff52f76 100644
--- a/compiler/java/com/google/dart/compiler/resolver/TopLevelElementBuilder.java
+++ b/compiler/java/com/google/dart/compiler/resolver/TopLevelElementBuilder.java
@@ -17,6 +17,7 @@ import com.google.dart.compiler.ast.DartField;
import com.google.dart.compiler.ast.DartFieldDefinition;
import com.google.dart.compiler.ast.DartFunctionTypeAlias;
import com.google.dart.compiler.ast.DartIdentifier;
+import com.google.dart.compiler.ast.DartLibraryDirective;
import com.google.dart.compiler.ast.DartMethodDefinition;
import com.google.dart.compiler.ast.DartNode;
import com.google.dart.compiler.ast.DartTypeParameter;
@@ -73,6 +74,21 @@ public class TopLevelElementBuilder {
// Fill "library" scope.
{
List<Element> exportedElements = Lists.newArrayList();
+ {
+ DartUnit selfUnit = library.getSelfDartUnit();
+ if (selfUnit != null && !selfUnit.getDirectives().isEmpty()
+ && selfUnit.getDirectives().get(0) instanceof DartLibraryDirective) {
+ DartLibraryDirective libraryDirective = (DartLibraryDirective) selfUnit.getDirectives().get(
+ 0);
+ if (!libraryDirective.isObsoleteFormat()) {
+ String name = libraryDirective.getLibraryName();
+ if (name != null) {
+ String elementName = "__library_" + name;
+ scope.declareElement(elementName, library.getElement());
+ }
+ }
+ }
+ }
for (DartUnit unit : library.getUnits()) {
fillInUnitScope(unit, listener, scope, exportedElements);
}

Powered by Google App Engine
This is Rietveld 408576698