Index: compiler/java/com/google/dart/compiler/resolver/MemberBuilder.java |
=================================================================== |
--- compiler/java/com/google/dart/compiler/resolver/MemberBuilder.java (revision 1034) |
+++ compiler/java/com/google/dart/compiler/resolver/MemberBuilder.java (working copy) |
@@ -113,6 +113,7 @@ |
case NONE: |
case CONSTRUCTOR: |
element = buildConstructor(method); |
+ checkConstructor(element, method); |
addConstructor((ClassElement) currentHolder, (ConstructorElement) element); |
break; |
@@ -429,6 +430,13 @@ |
// example const and missing body. |
} |
+ private void checkConstructor(MethodElement element, DartMethodDefinition method) { |
+ if (Elements.isNonFactoryConstructor(element) && method.getFunction() != null |
+ && method.getFunction().getReturnTypeNode() != null) { |
+ resolutionError(method, ResolverErrorCode.CONSTRUCTOR_CANNOT_HAVE_RETURN_TYPE); |
+ } |
+ } |
+ |
private void checkUniqueName(EnclosingElement holder, Element e) { |
Element other = lookupElementByName(holder, e.getName(), e.getModifiers()); |
assert e != other : "forgot to call checkUniqueName() before adding to the class?"; |