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

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

Issue 23769004: java2dart improvement - use field if getter/setter are trivial. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 3 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/Context.java
diff --git a/editor/util/plugins/com.google.dart.java2dart/src/com/google/dart/java2dart/Context.java b/editor/util/plugins/com.google.dart.java2dart/src/com/google/dart/java2dart/Context.java
index efea9757fc47b07a7a2e3e292ef0da796cffb693..67c65e716affa999c690d4d09d7f961ed00f4a90 100644
--- a/editor/util/plugins/com.google.dart.java2dart/src/com/google/dart/java2dart/Context.java
+++ b/editor/util/plugins/com.google.dart.java2dart/src/com/google/dart/java2dart/Context.java
@@ -620,6 +620,27 @@ public class Context {
return references != null ? references : Lists.<SimpleIdentifier> newArrayList();
}
+ /**
+ * Remembers that "identifier" is reference to the given Java binding.
+ */
+ public void putReference(SimpleIdentifier identifier, IBinding binding, String bindingSignature) {
+ if (binding != null) {
+ signatureToBinding.put(bindingSignature, binding);
+ identifierToName.put(identifier, identifier.getName());
+ // remember binding for reference
+ nodeToBinding.put(identifier, binding);
+ // add reference to binding
+ List<SimpleIdentifier> identifiers = bindingToIdentifiers.get(binding);
+ if (identifiers == null) {
+ identifiers = Lists.newLinkedList();
+ bindingToIdentifiers.put(binding, identifiers);
+ }
+ identifiers.add(identifier);
+ }
+ // remember global name
+ usedNames.add(identifier.getName());
+ }
+
public void renameConstructor(ConstructorDeclaration node, String name) {
IMethodBinding binding = constructorToBinding.get(node);
//
@@ -773,27 +794,6 @@ public class Context {
privateClassMembers.add(member);
}
- /**
- * Remembers that "identifier" is reference to the given Java binding.
- */
- void putReference(SimpleIdentifier identifier, IBinding binding, String bindingSignature) {
- if (binding != null) {
- signatureToBinding.put(bindingSignature, binding);
- identifierToName.put(identifier, identifier.getName());
- // remember binding for reference
- nodeToBinding.put(identifier, binding);
- // add reference to binding
- List<SimpleIdentifier> identifiers = bindingToIdentifiers.get(binding);
- if (identifiers == null) {
- identifiers = Lists.newLinkedList();
- bindingToIdentifiers.put(binding, identifiers);
- }
- identifiers.add(identifier);
- }
- // remember global name
- usedNames.add(identifier.getName());
- }
-
private void dontUseThisInFieldInitializers(CompilationUnit unit) {
unit.accept(new RecursiveASTVisitor<Void>() {
@Override

Powered by Google App Engine
This is Rietveld 408576698