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

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

Issue 23852002: java2dart improvements and new analyzer_experimental snapshot. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 4 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/BeautifySemanticProcessor.java
diff --git a/editor/util/plugins/com.google.dart.java2dart/src/com/google/dart/java2dart/processor/BeautifySemanticProcessor.java b/editor/util/plugins/com.google.dart.java2dart/src/com/google/dart/java2dart/processor/BeautifySemanticProcessor.java
index f98c66ad4a2c7c07c7209d5bd7af048a552a9504..261ccaec87730d686007166f2cf5a44d067005c4 100644
--- a/editor/util/plugins/com.google.dart.java2dart/src/com/google/dart/java2dart/processor/BeautifySemanticProcessor.java
+++ b/editor/util/plugins/com.google.dart.java2dart/src/com/google/dart/java2dart/processor/BeautifySemanticProcessor.java
@@ -14,13 +14,13 @@
package com.google.dart.java2dart.processor;
+import com.google.dart.engine.ast.ArgumentList;
import com.google.dart.engine.ast.AsExpression;
import com.google.dart.engine.ast.AssignmentExpression;
import com.google.dart.engine.ast.CompilationUnit;
import com.google.dart.engine.ast.ExpressionFunctionBody;
import com.google.dart.engine.ast.IntegerLiteral;
import com.google.dart.engine.ast.IsExpression;
-import com.google.dart.engine.ast.MethodInvocation;
import com.google.dart.engine.ast.ParenthesizedExpression;
import com.google.dart.engine.ast.PrefixExpression;
import com.google.dart.engine.ast.ReturnStatement;
@@ -36,12 +36,13 @@ import static com.google.dart.java2dart.util.TokenFactory.token;
*/
public class BeautifySemanticProcessor extends SemanticProcessor {
private static boolean canRemovePathenthesis(ParenthesizedExpression node) {
+ // unwrap all enclosing parentheses
+ while (node.getParent() instanceof ParenthesizedExpression) {
+ node = (ParenthesizedExpression) node.getParent();
+ }
// argument of invocation
- if (node.getParent() instanceof MethodInvocation) {
- MethodInvocation invocation = (MethodInvocation) node.getParent();
- if (invocation.getArgumentList().getArguments().contains(node)) {
- return true;
- }
+ if (node.getParent() instanceof ArgumentList) {
+ return true;
}
// RHS of assignment
if (node.getParent() instanceof AssignmentExpression) {

Powered by Google App Engine
This is Rietveld 408576698