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

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

Issue 11415065: Issue 6770. Support for @deprecated on library directive. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 1 month 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/Resolver.java
diff --git a/compiler/java/com/google/dart/compiler/resolver/Resolver.java b/compiler/java/com/google/dart/compiler/resolver/Resolver.java
index c3fd4d8e3549192495551baa81dcecc0389e561d..cc585dfba236f0a4524a071ff90bf133f537a907 100644
--- a/compiler/java/com/google/dart/compiler/resolver/Resolver.java
+++ b/compiler/java/com/google/dart/compiler/resolver/Resolver.java
@@ -40,6 +40,7 @@ import com.google.dart.compiler.ast.DartFunctionTypeAlias;
import com.google.dart.compiler.ast.DartGotoStatement;
import com.google.dart.compiler.ast.DartIdentifier;
import com.google.dart.compiler.ast.DartIfStatement;
+import com.google.dart.compiler.ast.DartImportDirective;
import com.google.dart.compiler.ast.DartInitializer;
import com.google.dart.compiler.ast.DartIntegerLiteral;
import com.google.dart.compiler.ast.DartInvocation;
@@ -76,6 +77,8 @@ import com.google.dart.compiler.ast.DartUnqualifiedInvocation;
import com.google.dart.compiler.ast.DartVariable;
import com.google.dart.compiler.ast.DartVariableStatement;
import com.google.dart.compiler.ast.DartWhileStatement;
+import com.google.dart.compiler.ast.LibraryImport;
+import com.google.dart.compiler.ast.LibraryUnit;
import com.google.dart.compiler.ast.Modifiers;
import com.google.dart.compiler.common.HasSourceInfo;
import com.google.dart.compiler.common.SourceInfo;
@@ -230,11 +233,33 @@ public class Resolver {
@Override
public Element visitUnit(DartUnit unit) {
+ List<DartImportDirective> importDirectives = Lists.newArrayList();
for (DartDirective directive : unit.getDirectives()) {
+ if (directive instanceof DartImportDirective) {
+ importDirectives.add((DartImportDirective) directive);
+ }
if (directive instanceof DartPartOfDirective) {
directive.accept(this);
}
}
+ // set LibraryElement for "import" directives
+ {
+ LibraryUnit library = unit.getLibrary();
+ if (library != null) {
+ Iterator<LibraryImport> importIterator = library.getImports().iterator();
+ Iterator<DartImportDirective> directiveIterator = importDirectives.iterator();
+ while (importIterator.hasNext() && directiveIterator.hasNext()) {
+ LibraryImport imp = importIterator.next();
+ DartImportDirective dir = directiveIterator.next();
+ DartStringLiteral uri = dir.getLibraryUri();
+ LibraryUnit impLibrary = imp.getLibrary();
+ if (uri != null && impLibrary != null) {
+ uri.setElement(impLibrary.getElement());
+ }
+ }
+ }
+ }
+ // visit top-level nodes
for (DartNode node : unit.getTopLevelNodes()) {
node.accept(this);
}

Powered by Google App Engine
This is Rietveld 408576698