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

Unified Diff: editor/util/plugins/com.google.dart.java2dart/src/com/google/dart/java2dart/engine/EngineSemanticProcessor.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/engine/EngineSemanticProcessor.java
diff --git a/editor/util/plugins/com.google.dart.java2dart/src/com/google/dart/java2dart/engine/EngineSemanticProcessor.java b/editor/util/plugins/com.google.dart.java2dart/src/com/google/dart/java2dart/engine/EngineSemanticProcessor.java
index 8545c993cb5c104dfe406c3677d36de11a430c07..1c09d2faeec74b71204ada3f64b8cce7daeed49b 100644
--- a/editor/util/plugins/com.google.dart.java2dart/src/com/google/dart/java2dart/engine/EngineSemanticProcessor.java
+++ b/editor/util/plugins/com.google.dart.java2dart/src/com/google/dart/java2dart/engine/EngineSemanticProcessor.java
@@ -442,7 +442,13 @@ public class EngineSemanticProcessor extends SemanticProcessor {
if (pair.getLeft().equals(className)) {
String fieldName = pair.getRight();
String accessorName = fieldName + accessorSuffix;
- String privateFieldName = "_" + fieldName;
+ String privatePropertyName;
+ if ("elementResolver".equals(fieldName) || "thisType".equals(fieldName)
+ || "typeAnalyzer".equals(fieldName)) {
+ privatePropertyName = "_" + fieldName;
+ } else {
+ privatePropertyName = fieldName;
+ }
node.getMembers().add(
methodDeclaration(
null,
@@ -451,7 +457,7 @@ public class EngineSemanticProcessor extends SemanticProcessor {
null,
identifier(accessorName),
null,
- expressionFunctionBody(identifier(privateFieldName))));
+ expressionFunctionBody(identifier(privatePropertyName))));
node.getMembers().add(
methodDeclaration(
null,
@@ -461,7 +467,7 @@ public class EngineSemanticProcessor extends SemanticProcessor {
identifier(accessorName),
formalParameterList(simpleFormalParameter("__v")),
expressionFunctionBody(assignmentExpression(
- identifier(privateFieldName),
+ identifier(privatePropertyName),
TokenType.EQ,
identifier("__v")))));
}
@@ -635,8 +641,8 @@ public class EngineSemanticProcessor extends SemanticProcessor {
ExpressionStatement doReadStatement = expressionStatement(methodInvocation(
receiverIdent,
"accept2",
- methodInvocation(identifier("_file"), "readAsStringSync"),
- methodInvocation(identifier("_file"), "lastModified")));
+ methodInvocation(identifier("file"), "readAsStringSync"),
+ methodInvocation(identifier("file"), "lastModified")));
node.setBody(blockFunctionBody(tryCacheBlock, doReadStatement));
return null;
}

Powered by Google App Engine
This is Rietveld 408576698