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

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: 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..be0582397c3b56acd89698bd9c743968a4f83ba9 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;
@@ -127,16 +125,21 @@ public class CollectionSemanticProcessor extends SemanticProcessor {
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);
- }
- }
+// 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);
+// }
+// }
+// }
+ // XXX
Brian Wilkerson 2014/04/26 17:04:52 Is this unfinished work, or just a left over marke
scheglov 2014/04/26 18:02:15 Left over marker. Removed.
+ if (compareMethod.getBody() instanceof ExpressionFunctionBody) {
+ ExpressionFunctionBody expressionFunctionBody = (ExpressionFunctionBody) compareMethod.getBody();
+ expressionFunctionBody.setSemicolon(null);
}
// do replace
replaceNode(node, functionExpression);
@@ -261,6 +264,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