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

Unified Diff: compiler/java/com/google/dart/compiler/resolver/Resolver.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
« no previous file with comments | « no previous file | compiler/java/com/google/dart/compiler/resolver/TopLevelElementBuilder.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/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 44cb5841957fa5196bce9b4f57daec660dc021fc..d6c31cacdbdd86d30055a82d70766dd1e4839b22 100644
--- a/compiler/java/com/google/dart/compiler/resolver/Resolver.java
+++ b/compiler/java/com/google/dart/compiler/resolver/Resolver.java
@@ -20,6 +20,7 @@ import com.google.dart.compiler.ast.DartCatchBlock;
import com.google.dart.compiler.ast.DartClass;
import com.google.dart.compiler.ast.DartClassMember;
import com.google.dart.compiler.ast.DartContinueStatement;
+import com.google.dart.compiler.ast.DartDirective;
import com.google.dart.compiler.ast.DartDoWhileStatement;
import com.google.dart.compiler.ast.DartDoubleLiteral;
import com.google.dart.compiler.ast.DartExpression;
@@ -47,6 +48,7 @@ import com.google.dart.compiler.ast.DartNewExpression;
import com.google.dart.compiler.ast.DartNode;
import com.google.dart.compiler.ast.DartParameter;
import com.google.dart.compiler.ast.DartParameterizedTypeNode;
+import com.google.dart.compiler.ast.DartPartOfDirective;
import com.google.dart.compiler.ast.DartPropertyAccess;
import com.google.dart.compiler.ast.DartRedirectConstructorInvocation;
import com.google.dart.compiler.ast.DartReturnStatement;
@@ -221,6 +223,11 @@ public class Resolver {
@Override
public Element visitUnit(DartUnit unit) {
+ for (DartDirective directive : unit.getDirectives()) {
+ if (directive instanceof DartPartOfDirective) {
+ directive.accept(this);
+ }
+ }
for (DartNode node : unit.getTopLevelNodes()) {
node.accept(this);
}
@@ -986,6 +993,17 @@ public class Resolver {
}
return null;
}
+
+ @Override
+ public Element visitPartOfDirective(DartPartOfDirective node) {
+ String elementName = "__library_" + node.getLibraryName();
+ Element element = context.getScope().findElement(null, elementName);
+ if (ElementKind.of(element) == ElementKind.LIBRARY) {
+ node.getName().setElement(element);
+ return element;
+ }
+ return null;
+ }
@Override
public Element visitSuperExpression(DartSuperExpression x) {
« no previous file with comments | « no previous file | compiler/java/com/google/dart/compiler/resolver/TopLevelElementBuilder.java » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698