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

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

Issue 197213036: New analyzer snapshot. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Update pubspec and recent changes. Created 6 years, 9 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
« no previous file with comments | « no previous file | editor/util/plugins/com.google.dart.java2dart/src/com/google/dart/java2dart/processor/IOSemanticProcessor.java » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: editor/util/plugins/com.google.dart.java2dart/src/com/google/dart/java2dart/SyntaxTranslator.java
diff --git a/editor/util/plugins/com.google.dart.java2dart/src/com/google/dart/java2dart/SyntaxTranslator.java b/editor/util/plugins/com.google.dart.java2dart/src/com/google/dart/java2dart/SyntaxTranslator.java
index 2788414f47b21fd83e5c0ebe1ea7547175e20fdb..e2b7a2f49093a1d241b51c5a62a5190a850a83db 100644
--- a/editor/util/plugins/com.google.dart.java2dart/src/com/google/dart/java2dart/SyntaxTranslator.java
+++ b/editor/util/plugins/com.google.dart.java2dart/src/com/google/dart/java2dart/SyntaxTranslator.java
@@ -1864,11 +1864,14 @@ public class SyntaxTranslator extends org.eclipse.jdt.core.dom.ASTVisitor {
private SimpleIdentifier replaceEnclosingClassMemberReferences(final ClassDeclaration innerClass,
final ITypeBinding enclosingTypeBinding) {
- final SimpleIdentifier enclosingTypeRef;
+ final SimpleIdentifier enclosingTypeInstRef;
+ final SimpleIdentifier enclosingTypeNameRef;
final AtomicBoolean addEnclosingTypeRef = new AtomicBoolean();
{
if (enclosingTypeBinding != null) {
- enclosingTypeRef = identifier(enclosingTypeBinding.getName() + "_this");
+ String enclosingTypeName = enclosingTypeBinding.getName();
+ enclosingTypeInstRef = identifier(enclosingTypeName + "_this");
+ enclosingTypeNameRef = identifier(enclosingTypeName);
// add enclosing class references
innerClass.accept(new RecursiveAstVisitor<Void>() {
@Override
@@ -1880,35 +1883,33 @@ public class SyntaxTranslator extends org.eclipse.jdt.core.dom.ASTVisitor {
if (methodBinding != null
&& JavaUtils.isSubtype(enclosingTypeBinding, methodBinding.getDeclaringClass())) {
addEnclosingTypeRef.set(true);
- node.setTarget(enclosingTypeRef);
+ node.setTarget(enclosingTypeInstRef);
}
}
return super.visitMethodInvocation(node);
}
@Override
+ public Void visitPropertyAccess(PropertyAccess node) {
+ node.getTarget().accept(this);
+ return null;
+ }
+
+ @Override
public Void visitSimpleIdentifier(SimpleIdentifier node) {
- AstNode target = null;
if (node.getParent() instanceof PrefixedIdentifier) {
return null;
}
- if (node.getParent() instanceof PropertyAccess) {
- PropertyAccess access = (PropertyAccess) node.getParent();
- target = access.getTarget();
- if (!(target instanceof ThisExpression)) {
- return null;
- }
- }
Object binding = context.getNodeBinding(node);
if (binding instanceof IVariableBinding) {
IVariableBinding variableBinding = (IVariableBinding) binding;
if (variableBinding.isField()
&& variableBinding.getDeclaringClass() == enclosingTypeBinding) {
addEnclosingTypeRef.set(true);
- if (target == null) {
- replaceNode(node.getParent(), node, propertyAccess(enclosingTypeRef, node));
+ if (JavaUtils.isStatic(variableBinding)) {
+ replaceNode(node.getParent(), node, propertyAccess(enclosingTypeNameRef, node));
} else {
- replaceNode(target.getParent(), target, enclosingTypeRef);
+ replaceNode(node.getParent(), node, propertyAccess(enclosingTypeInstRef, node));
}
}
}
@@ -1920,19 +1921,19 @@ public class SyntaxTranslator extends org.eclipse.jdt.core.dom.ASTVisitor {
ITypeBinding binding = context.getNodeTypeBinding(node);
if (JavaUtils.isSubtype(enclosingTypeBinding, binding)) {
addEnclosingTypeRef.set(true);
- replaceNode(node.getParent(), node, enclosingTypeRef);
+ replaceNode(node.getParent(), node, enclosingTypeInstRef);
}
return super.visitThisExpression(node);
}
});
} else {
- enclosingTypeRef = null;
+ enclosingTypeInstRef = null;
}
}
if (!addEnclosingTypeRef.get()) {
return null;
}
- return enclosingTypeRef;
+ return enclosingTypeInstRef;
}
/**
« no previous file with comments | « no previous file | editor/util/plugins/com.google.dart.java2dart/src/com/google/dart/java2dart/processor/IOSemanticProcessor.java » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698