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

Unified Diff: editor/util/plugins/com.google.dart.java2dart/src/com/google/dart/java2dart/processor/ConstructorSemanticProcessor.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/ConstructorSemanticProcessor.java
diff --git a/editor/util/plugins/com.google.dart.java2dart/src/com/google/dart/java2dart/processor/ConstructorSemanticProcessor.java b/editor/util/plugins/com.google.dart.java2dart/src/com/google/dart/java2dart/processor/ConstructorSemanticProcessor.java
index c56fa791f1396acf2c3590290b864896a296e278..a10f8d5e212dc1264c52e30666a5add38c8ed994 100644
--- a/editor/util/plugins/com.google.dart.java2dart/src/com/google/dart/java2dart/processor/ConstructorSemanticProcessor.java
+++ b/editor/util/plugins/com.google.dart.java2dart/src/com/google/dart/java2dart/processor/ConstructorSemanticProcessor.java
@@ -42,6 +42,7 @@ import static com.google.dart.java2dart.util.ASTFactory.typeName;
import org.eclipse.jdt.core.dom.IMethodBinding;
+import java.util.Iterator;
import java.util.List;
/**
@@ -183,10 +184,18 @@ public class ConstructorSemanticProcessor extends SemanticProcessor {
return;
}
// add redirecting constructor invocation
+ List<ConstructorInitializer> initializers = node.getInitializers();
RedirectingConstructorInvocation redirect = redirectingConstructorInvocation(
"thisConstructorRedirection",
methodInvocation.getArgumentList().getArguments());
- node.getInitializers().add(redirect);
+ initializers.add(redirect);
+ // remove speculative "super" constructor invocation
+ for (Iterator<ConstructorInitializer> iter = initializers.iterator(); iter.hasNext();) {
+ ConstructorInitializer initializer = iter.next();
+ if (initializer instanceof SuperConstructorInvocation) {
+ iter.remove();
+ }
+ }
// remove body
node.setBody(emptyFunctionBody());
// record constructor invocation

Powered by Google App Engine
This is Rietveld 408576698