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

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

Issue 10699005: When a variable name is used as a type, emit a warning, not an error (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Updated junit tests Created 8 years, 6 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/TypeErrorCode.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/ResolutionContext.java
diff --git a/compiler/java/com/google/dart/compiler/resolver/ResolutionContext.java b/compiler/java/com/google/dart/compiler/resolver/ResolutionContext.java
index 734ecb944ae017d7123987573f0ca46f0395bd7a..61a25f393099afdb3e58a6264d79d5c727626504 100644
--- a/compiler/java/com/google/dart/compiler/resolver/ResolutionContext.java
+++ b/compiler/java/com/google/dart/compiler/resolver/ResolutionContext.java
@@ -217,7 +217,8 @@ public class ResolutionContext implements ResolutionErrorListener {
}
Type resolveType(DartNode diagnosticNode, DartNode identifier, List<DartTypeNode> typeArguments,
- boolean isStatic, boolean isFactory, ErrorCode errorCode, ErrorCode wrongNumberErrorCode) {
+ boolean isStatic, boolean isFactory, ErrorCode errorCode,
+ ErrorCode wrongNumberErrorCode) {
// Built-in identifier can not be used as a type annotation.
if (identifier instanceof DartIdentifier) {
String name = ((DartIdentifier) identifier).getName();
@@ -261,7 +262,11 @@ public class ResolutionContext implements ResolutionErrorListener {
return typeProvider.getDynamicType();
default:
- onError(identifier, ResolverErrorCode.NOT_A_TYPE, identifier, elementKind);
+ if (errorCode.getSubSystem().equals(SubSystem.RESOLVER)) {
+ onError(identifier, ResolverErrorCode.NOT_A_TYPE, identifier, elementKind);
+ } else {
+ onError(identifier, TypeErrorCode.NOT_A_TYPE, identifier, elementKind);
+ }
return typeProvider.getDynamicType();
}
}
@@ -288,7 +293,11 @@ public class ResolutionContext implements ResolutionErrorListener {
return typeProvider.getDynamicType();
default:
if (!(identifier instanceof DartSyntheticErrorIdentifier)) {
- onError(identifier, ResolverErrorCode.NOT_A_TYPE, identifier, elementKind);
+ if (errorCode.getSubSystem().equals(SubSystem.RESOLVER)) {
+ onError(identifier, ResolverErrorCode.NOT_A_TYPE, identifier, elementKind);
+ } else {
+ onError(identifier, TypeErrorCode.NOT_A_TYPE, identifier, elementKind);
+ }
}
return typeProvider.getDynamicType();
}
« no previous file with comments | « no previous file | compiler/java/com/google/dart/compiler/resolver/TypeErrorCode.java » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698