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

Unified Diff: editor/tools/plugins/com.google.dart.tools.core/src/com/google/dart/tools/core/utilities/bindings/BindingUtils.java

Issue 10919203: Issue 5044. Make all abstract fields resolve to setter or getter methods. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 3 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: editor/tools/plugins/com.google.dart.tools.core/src/com/google/dart/tools/core/utilities/bindings/BindingUtils.java
diff --git a/editor/tools/plugins/com.google.dart.tools.core/src/com/google/dart/tools/core/utilities/bindings/BindingUtils.java b/editor/tools/plugins/com.google.dart.tools.core/src/com/google/dart/tools/core/utilities/bindings/BindingUtils.java
index b47d8fea43b59f4f50e6fbb6cd20c5568a22ca7b..8834855ff73c036c83fa8feab3f5bd64f8f2ca36 100644
--- a/editor/tools/plugins/com.google.dart.tools.core/src/com/google/dart/tools/core/utilities/bindings/BindingUtils.java
+++ b/editor/tools/plugins/com.google.dart.tools.core/src/com/google/dart/tools/core/utilities/bindings/BindingUtils.java
@@ -13,6 +13,7 @@
*/
package com.google.dart.tools.core.utilities.bindings;
+import com.google.common.base.Objects;
import com.google.common.collect.MapMaker;
import com.google.dart.compiler.LibrarySource;
import com.google.dart.compiler.PackageLibraryManager;
@@ -553,7 +554,11 @@ public class BindingUtils {
if (methodBinding == null) {
return null;
}
+ int methodNumParameters = methodBinding.getParameters().size();
String methodName = methodBinding.getName();
+ if ("-binary".equals(methodName)) {
+ methodName = "-";
+ }
Element enclosingElement = methodBinding.getEnclosingElement();
if (enclosingElement == null) {
// We don't have enough information to find the method or function.
@@ -567,6 +572,15 @@ public class BindingUtils {
List<com.google.dart.tools.core.model.DartFunction> matchingFunctions = getImmediateFunctions(
definingLibrary,
methodBinding.getName());
+ try {
+ for (com.google.dart.tools.core.model.DartFunction function : matchingFunctions) {
+ if (Objects.equal(methodName, function.getElementName())
+ && function.getParameterNames().length == methodNumParameters) {
+ return function;
+ }
+ }
+ } catch (DartModelException exception) {
+ }
if (matchingFunctions.size() == 1) {
return matchingFunctions.get(0);
}
@@ -604,11 +618,8 @@ public class BindingUtils {
}
try {
for (Method method : declaringType.getMethods()) {
- if (methodName.equals("-binary") && "-".equals(method.getElementName())
- && method.getParameterNames().length == 1) {
- return method;
- }
- if (methodName.equals(method.getElementName())) {
+ if (Objects.equal(methodName, method.getElementName())
+ && method.getParameterNames().length == methodNumParameters) {
return method;
}
}

Powered by Google App Engine
This is Rietveld 408576698