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

Unified Diff: editor/util/plugins/com.google.dart.java2dart/src/com/google/dart/java2dart/processor/PropertySemanticProcessor.java

Issue 24481002: New analyzer_experimental snapshot. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 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/util/plugins/com.google.dart.java2dart/src/com/google/dart/java2dart/processor/PropertySemanticProcessor.java
diff --git a/editor/util/plugins/com.google.dart.java2dart/src/com/google/dart/java2dart/processor/PropertySemanticProcessor.java b/editor/util/plugins/com.google.dart.java2dart/src/com/google/dart/java2dart/processor/PropertySemanticProcessor.java
index b2b4f7691f54983139da1ab65892140b724d9118..2be66ec006a830000a7f58fa7086f8be824755d5 100644
--- a/editor/util/plugins/com.google.dart.java2dart/src/com/google/dart/java2dart/processor/PropertySemanticProcessor.java
+++ b/editor/util/plugins/com.google.dart.java2dart/src/com/google/dart/java2dart/processor/PropertySemanticProcessor.java
@@ -48,6 +48,8 @@ import static com.google.dart.java2dart.util.TokenFactory.token;
import org.apache.commons.lang3.StringUtils;
import org.eclipse.jdt.core.dom.IBinding;
import org.eclipse.jdt.core.dom.IMethodBinding;
+import org.eclipse.jdt.core.dom.ITypeBinding;
+import org.eclipse.jdt.core.dom.IVariableBinding;
import java.util.List;
import java.util.Map;
@@ -266,16 +268,15 @@ public class PropertySemanticProcessor extends SemanticProcessor {
@Override
public Void visitMethodDeclaration(MethodDeclaration node) {
+ IMethodBinding binding = (IMethodBinding) context.getNodeBinding(node);
// don't remove method if it overrides
- {
- IMethodBinding binding = (IMethodBinding) context.getNodeBinding(node);
- if (binding == null) {
- return null;
- }
- if (ignoredMethods.contains(binding)) {
- return null;
- }
+ if (binding == null) {
+ return null;
+ }
+ if (ignoredMethods.contains(binding)) {
+ return null;
}
+ ITypeBinding declaringClass = binding.getDeclaringClass();
// getter
if (node.isGetter()) {
String name = node.getName().getName();
@@ -286,6 +287,17 @@ public class PropertySemanticProcessor extends SemanticProcessor {
Expression expression = body.getExpression();
if (expression instanceof SimpleIdentifier) {
SimpleIdentifier identifier = (SimpleIdentifier) expression;
+ // may be not a local field
+ IBinding identifierBinding = context.getNodeBinding(identifier);
+ if (identifierBinding instanceof IVariableBinding) {
+ IVariableBinding fieldBinding = (IVariableBinding) identifierBinding;
+ if (fieldBinding.getDeclaringClass() != declaringClass) {
+ return null;
+ }
+ } else {
+ return null;
+ }
+ // OK, remember the field
property.getterField = identifier.getName();
}
}

Powered by Google App Engine
This is Rietveld 408576698