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

Unified Diff: editor/tools/plugins/com.google.dart.engine/src/com/google/dart/engine/internal/verifier/ErrorVerifier.java

Issue 66373002: Version 0.8.10.10 (Closed) Base URL: http://dart.googlecode.com/svn/trunk/dart/
Patch Set: Created 7 years, 1 month 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: 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.
*

Powered by Google App Engine
This is Rietveld 408576698