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

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

Issue 8384018: https://code.google.com/p/dart/issues/detail?id=223 (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: '' Created 9 years, 2 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/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?";

Powered by Google App Engine
This is Rietveld 408576698