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

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

Issue 11377039: Issue 6251. Resolve and rename type and constructor references in [new Type.name]. (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 e9c2e5b21c2ef06a2b5fd59449aa7764148367b7..91a5f7cdeba75c38bddebffb3023a8c0eb020d35 100644
--- a/compiler/java/com/google/dart/compiler/resolver/Resolver.java
+++ b/compiler/java/com/google/dart/compiler/resolver/Resolver.java
@@ -21,6 +21,8 @@ import com.google.dart.compiler.ast.DartCase;
import com.google.dart.compiler.ast.DartCatchBlock;
import com.google.dart.compiler.ast.DartClass;
import com.google.dart.compiler.ast.DartComment;
+import com.google.dart.compiler.ast.DartCommentNewName;
+import com.google.dart.compiler.ast.DartCommentRefName;
import com.google.dart.compiler.ast.DartContinueStatement;
import com.google.dart.compiler.ast.DartDirective;
import com.google.dart.compiler.ast.DartDoWhileStatement;
@@ -305,6 +307,32 @@ public class Resolver {
}
@Override
+ public Element visitCommentRefName(DartCommentRefName node) {
+ Scope scope = getContext().getScope();
+ String name = node.getName();
+ Element element = scope.findElement(scope.getLibrary(), name);
+ return recordElement(node, element);
+ }
+
+ @Override
+ public Element visitCommentNewName(DartCommentNewName node) {
+ String className = node.getClassName();
+ String constructorName = node.getConstructorName();
+ Scope scope = getContext().getScope();
+ Element element = scope.findElement(scope.getLibrary(), className);
+ if (ElementKind.of(element) == ElementKind.CLASS) {
+ ClassElement classElement = (ClassElement) element;
+ for (ConstructorElement constructor : classElement.getConstructors()) {
+ if (constructor.getName().equals(constructorName)) {
+ node.setElements(classElement, constructor);
+ return constructor;
+ }
+ }
+ }
+ return null;
+ }
+
+ @Override
public Element visitClass(DartClass cls) {
assert currentMethod == null : "nested class?";
ClassNodeElement classElement = cls.getElement();
@@ -408,7 +436,7 @@ public class Resolver {
}
});
}
-
+
{
DartComment comment = cls.getDartDoc();
if (comment != null) {

Powered by Google App Engine
This is Rietveld 408576698