Chromium Code Reviews| 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; |