| Index: editor/tools/plugins/com.google.dart.engine/src/com/google/dart/engine/internal/verifier/ErrorVerifier.java
|
| ===================================================================
|
| --- editor/tools/plugins/com.google.dart.engine/src/com/google/dart/engine/internal/verifier/ErrorVerifier.java (revision 30100)
|
| +++ editor/tools/plugins/com.google.dart.engine/src/com/google/dart/engine/internal/verifier/ErrorVerifier.java (working copy)
|
| @@ -800,6 +800,8 @@
|
| checkForOptionalParameterInOperator(node);
|
| checkForWrongNumberOfParametersForOperator(node);
|
| checkForNonVoidReturnTypeForOperator(node);
|
| + } else {
|
| + checkForConflictingInstanceMethodSetter(node);
|
| }
|
| checkForConcreteClassWithAbstractMember(node);
|
| checkForAllInvalidOverrideErrorCodes(node);
|
| @@ -2262,6 +2264,43 @@
|
| }
|
|
|
| /**
|
| + * This verifies that the enclosing class does not have a setter with the same name as the passed
|
| + * instance method declaration.
|
| + *
|
| + * @param node the method declaration to evaluate
|
| + * @return {@code true} if and only if an error code is generated on the passed node
|
| + * @see StaticWarningCode#CONFLICTING_INSTANCE_METHOD_SETTER
|
| + */
|
| + private boolean checkForConflictingInstanceMethodSetter(MethodDeclaration node) {
|
| + if (node.isStatic()) {
|
| + return false;
|
| + }
|
| + // prepare name
|
| + SimpleIdentifier nameNode = node.getName();
|
| + if (nameNode == null) {
|
| + return false;
|
| + }
|
| + String name = nameNode.getName();
|
| + // ensure that we have enclosing class
|
| + if (enclosingClass == null) {
|
| + return false;
|
| + }
|
| + // try to find setter
|
| + ExecutableElement setter = inheritanceManager.lookupMember(enclosingClass, name + "=");
|
| + if (setter == null) {
|
| + return false;
|
| + }
|
| + // report problem
|
| + errorReporter.reportError(
|
| + StaticWarningCode.CONFLICTING_INSTANCE_METHOD_SETTER,
|
| + nameNode,
|
| + enclosingClass.getDisplayName(),
|
| + name,
|
| + setter.getEnclosingElement().getDisplayName());
|
| + return true;
|
| + }
|
| +
|
| + /**
|
| * This verifies that the enclosing class does not have an instance member with the same name as
|
| * the passed static getter method declaration.
|
| *
|
|
|