| Index: editor/tools/plugins/com.google.dart.engine/src/com/google/dart/engine/internal/resolver/ElementResolver.java
|
| diff --git a/editor/tools/plugins/com.google.dart.engine/src/com/google/dart/engine/internal/resolver/ElementResolver.java b/editor/tools/plugins/com.google.dart.engine/src/com/google/dart/engine/internal/resolver/ElementResolver.java
|
| index 00c9a626575bacb3a07a8a69b99d788b13f3ec4d..5532cd276ca8f762f5b727c8f61b951270f69d37 100644
|
| --- a/editor/tools/plugins/com.google.dart.engine/src/com/google/dart/engine/internal/resolver/ElementResolver.java
|
| +++ b/editor/tools/plugins/com.google.dart.engine/src/com/google/dart/engine/internal/resolver/ElementResolver.java
|
| @@ -22,6 +22,7 @@ import com.google.dart.engine.ast.BinaryExpression;
|
| import com.google.dart.engine.ast.BreakStatement;
|
| import com.google.dart.engine.ast.Combinator;
|
| import com.google.dart.engine.ast.CommentReference;
|
| +import com.google.dart.engine.ast.ConstructorDeclaration;
|
| import com.google.dart.engine.ast.ConstructorFieldInitializer;
|
| import com.google.dart.engine.ast.ConstructorName;
|
| import com.google.dart.engine.ast.ContinueStatement;
|
| @@ -200,6 +201,18 @@ public class ElementResolver extends SimpleASTVisitor<Void> {
|
| }
|
|
|
| /**
|
| + * @return {@code true} if the given identifier is the return type of a constructor declaration.
|
| + */
|
| + private static boolean isConstructorReturnType(SimpleIdentifier node) {
|
| + ASTNode parent = node.getParent();
|
| + if (parent instanceof ConstructorDeclaration) {
|
| + ConstructorDeclaration constructor = (ConstructorDeclaration) parent;
|
| + return constructor.getReturnType() == node;
|
| + }
|
| + return false;
|
| + }
|
| +
|
| + /**
|
| * The resolver driving this participant.
|
| */
|
| private ResolverVisitor resolver;
|
| @@ -829,7 +842,9 @@ public class ElementResolver extends SimpleASTVisitor<Void> {
|
| }
|
| if (element == null) {
|
| // TODO(brianwilkerson) Recover from this error.
|
| - if (!classDeclaresNoSuchMethod(enclosingClass)) {
|
| + if (isConstructorReturnType(node)) {
|
| + resolver.reportError(CompileTimeErrorCode.INVALID_CONSTRUCTOR_NAME, node);
|
| + } else if (!classDeclaresNoSuchMethod(enclosingClass)) {
|
| resolver.reportError(StaticWarningCode.UNDEFINED_IDENTIFIER, node, node.getName());
|
| }
|
| } else if (element instanceof ExecutableElement) {
|
|
|