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

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

Issue 10006030: Add element to qualifier name for code completion (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Added JUnit test 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/java/com/google/dart/compiler/resolver/ResolverErrorCode.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 e45732bddb13accb17ba56f65998dfacd9963555..c32f7cd679f5babaf556b34167ba7f80fa33600c 100644
--- a/compiler/java/com/google/dart/compiler/resolver/Resolver.java
+++ b/compiler/java/com/google/dart/compiler/resolver/Resolver.java
@@ -1131,6 +1131,9 @@ public class Resolver {
default:
break;
}
+ if (x.getName() != null) {
+ recordElement(x.getName(), element);
+ }
return recordElement(x, element);
}
@@ -1154,7 +1157,7 @@ public class Resolver {
element = Elements.lookupLocalField(classElement, x.getFunctionNameString());
}
if (element == null || !element.getModifiers().isStatic()) {
- diagnoseErrorInMethodInvocation(x, (ClassElement) target, element);
+ diagnoseErrorInMethodInvocation(x, classElement, element);
}
break;
}
@@ -1178,7 +1181,7 @@ public class Resolver {
element = library.getScope().findElement(context.getScope().getLibrary(),
x.getFunctionNameString());
if (element == null) {
- diagnoseErrorInMethodInvocation(x, null, null);
+ diagnoseErrorInMethodInvocation(x, library, null);
} else {
x.getFunctionName().setElement(element);
}
@@ -1384,25 +1387,37 @@ public class Resolver {
}
}
- private void diagnoseErrorInMethodInvocation(DartMethodInvocation node, ClassElement klass,
+ private void diagnoseErrorInMethodInvocation(DartMethodInvocation node, Element classOrLibrary,
Element element) {
String name = node.getFunctionNameString();
ElementKind kind = ElementKind.of(element);
DartNode errorNode = node.getFunctionName();
switch (kind) {
case NONE:
- onError(errorNode, ResolverErrorCode.CANNOT_RESOLVE_METHOD, name);
+ switch (ElementKind.of(classOrLibrary)) {
+ case CLASS:
+ onError(errorNode, ResolverErrorCode.CANNOT_RESOLVE_METHOD_IN_CLASS, name,
+ classOrLibrary.getName());
+ break;
+ case LIBRARY:
+ onError(errorNode, ResolverErrorCode.CANNOT_RESOLVE_METHOD_IN_LIBRARY, name,
+ classOrLibrary.getName());
+ break;
+ default:
+ onError(errorNode, ResolverErrorCode.CANNOT_RESOLVE_METHOD, name);
+ }
+
break;
case CONSTRUCTOR:
- onError(errorNode, ResolverErrorCode.IS_A_CONSTRUCTOR, klass.getName(),
+ onError(errorNode, ResolverErrorCode.IS_A_CONSTRUCTOR, classOrLibrary.getName(),
name);
break;
case METHOD: {
assert !((MethodElement) element).getModifiers().isStatic();
onError(errorNode, ResolverErrorCode.IS_AN_INSTANCE_METHOD,
- klass.getName(), name);
+ classOrLibrary.getName(), name);
break;
}
« no previous file with comments | « no previous file | compiler/java/com/google/dart/compiler/resolver/ResolverErrorCode.java » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698