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

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

Issue 250823006: Translate parts of engine.services project. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Move to pkg/analysis_services/ Created 6 years, 8 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/CollectionSemanticProcessor.java
diff --git a/editor/util/plugins/com.google.dart.java2dart/src/com/google/dart/java2dart/processor/CollectionSemanticProcessor.java b/editor/util/plugins/com.google.dart.java2dart/src/com/google/dart/java2dart/processor/CollectionSemanticProcessor.java
index 961b344034a0a51c6402042bfe14a0484b3e077b..cb21c624e4878d93d553925b9c0d0b00e44ca9d5 100644
--- a/editor/util/plugins/com.google.dart.java2dart/src/com/google/dart/java2dart/processor/CollectionSemanticProcessor.java
+++ b/editor/util/plugins/com.google.dart.java2dart/src/com/google/dart/java2dart/processor/CollectionSemanticProcessor.java
@@ -30,8 +30,6 @@ import com.google.dart.engine.ast.MethodDeclaration;
import com.google.dart.engine.ast.MethodInvocation;
import com.google.dart.engine.ast.SimpleIdentifier;
import com.google.dart.engine.ast.TypeName;
-import com.google.dart.engine.ast.VariableDeclaration;
-import com.google.dart.engine.ast.VariableDeclarationList;
import com.google.dart.engine.ast.visitor.GeneralizingAstVisitor;
import com.google.dart.engine.scanner.Keyword;
import com.google.dart.engine.scanner.TokenType;
@@ -126,17 +124,10 @@ public class CollectionSemanticProcessor extends SemanticProcessor {
FunctionExpression functionExpression = functionExpression(
compareMethod.getParameters(),
compareMethod.getBody());
- // don't add ";" at the end of ExpressionFunctionBody of the last first field
- if (node.getParent() instanceof VariableDeclaration
- && node.getParent().getParent() instanceof VariableDeclarationList) {
- VariableDeclarationList variableDeclarationList = (VariableDeclarationList) node.getParent().getParent();
- int index = variableDeclarationList.getVariables().indexOf(node.getParent());
- if (index == variableDeclarationList.getVariables().size() - 1) {
- if (compareMethod.getBody() instanceof ExpressionFunctionBody) {
- ExpressionFunctionBody expressionFunctionBody = (ExpressionFunctionBody) compareMethod.getBody();
- expressionFunctionBody.setSemicolon(null);
- }
- }
+ // don't add ";" at the end of ExpressionFunctionBody
+ if (compareMethod.getBody() instanceof ExpressionFunctionBody) {
+ ExpressionFunctionBody expressionFunctionBody = (ExpressionFunctionBody) compareMethod.getBody();
+ expressionFunctionBody.setSemicolon(null);
}
// do replace
replaceNode(node, functionExpression);
@@ -261,6 +252,10 @@ public class CollectionSemanticProcessor extends SemanticProcessor {
nameNode.setToken(token("makeHashCode"));
return null;
}
+ if (isMethodInClass(node, "sort", "java.util.Collections")) {
+ replaceNode(node, methodInvocation(args.get(0), "sort", args.get(1)));
+ return null;
+ }
if (isMethodInClass(node, "noneOf", "java.util.EnumSet")) {
replaceNode(node, instanceCreationExpression(Keyword.NEW, typeName("Set")));
return null;

Powered by Google App Engine
This is Rietveld 408576698