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

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

Issue 10970024: Issue 5240. Using a non-type in a const object expression is an error, not a warning (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 3 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
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 7df44654da231f1fc7fbfd6e4828e8f42e0c1dda..05157b2cbc2e1bc819c683871cdbb4f83bf9af0f 100644
--- a/compiler/java/com/google/dart/compiler/resolver/Resolver.java
+++ b/compiler/java/com/google/dart/compiler/resolver/Resolver.java
@@ -1566,7 +1566,7 @@ public class Resolver {
// Only 'new' expressions can have a type in a property access.
@Override
public Element visitTypeNode(DartTypeNode type) {
- TypeErrorCode errorCode = x.isConst() ? TypeErrorCode.NO_SUCH_TYPE_CONST : TypeErrorCode.NO_SUCH_TYPE;
+ ErrorCode errorCode = x.isConst() ? ResolverErrorCode.NO_SUCH_TYPE_CONST : TypeErrorCode.NO_SUCH_TYPE;
return recordType(type, resolveType(type, inStaticContext(currentMethod),
inFactoryContext(currentMethod),
errorCode,
@@ -2123,9 +2123,12 @@ public class Resolver {
}
}
- private ConstructorElement checkIsConstructor(DartNewExpression source, Element element) {
+ private ConstructorElement checkIsConstructor(DartNewExpression node, Element element) {
if (!ElementKind.of(element).equals(ElementKind.CONSTRUCTOR)) {
- onError(source.getConstructor(), ResolverErrorCode.NEW_EXPRESSION_NOT_CONSTRUCTOR);
+ ResolverErrorCode errorCode = node.isConst()
+ ? ResolverErrorCode.NEW_EXPRESSION_NOT_CONST_CONSTRUCTOR
+ : ResolverErrorCode.NEW_EXPRESSION_NOT_CONSTRUCTOR;
+ onError(ASTNodes.getConstructorNameNode(node), errorCode);
return null;
}
return (ConstructorElement) element;

Powered by Google App Engine
This is Rietveld 408576698