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

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

Issue 189043003: Improved 'has' properties translation. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 9 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/PropertySemanticProcessor.java
diff --git a/editor/util/plugins/com.google.dart.java2dart/src/com/google/dart/java2dart/processor/PropertySemanticProcessor.java b/editor/util/plugins/com.google.dart.java2dart/src/com/google/dart/java2dart/processor/PropertySemanticProcessor.java
index 332c98681ddb238fdb5e14f4a65b63d8d78f9841..643c7c122a554cea40971cc66270011afdd9a32d 100644
--- a/editor/util/plugins/com.google.dart.java2dart/src/com/google/dart/java2dart/processor/PropertySemanticProcessor.java
+++ b/editor/util/plugins/com.google.dart.java2dart/src/com/google/dart/java2dart/processor/PropertySemanticProcessor.java
@@ -275,11 +275,18 @@ public class PropertySemanticProcessor extends SemanticProcessor {
String name = context.getIdentifierOriginalName(nameNode);
List<FormalParameter> parameters = node.getParameters().getParameters();
// getter
- if (parameters.isEmpty() && (hasPrefix(name, "get") || hasPrefix(name, "is"))) {
+ if (parameters.isEmpty()
+ && (hasPrefix(name, "get") || hasPrefix(name, "is") || hasPrefix(name, "has"))) {
if (!context.canMakeProperty(nameNode)) {
return null;
}
- String propertyName = StringUtils.uncapitalize(StringUtils.removeStart(name, "get"));
+ String propertyName = name;
+ if (hasPrefix(name, "get")) {
+ propertyName = StringUtils.removeStart(name, "get");
+ } else if (hasPrefix(name, "is")) {
Brian Wilkerson 2014/03/06 21:31:55 Not sure why we're testing for it if we're not doi
+ // don't remove "is" prefix, for example because we want to keep "isSynthetic" name
+ }
+ propertyName = StringUtils.uncapitalize(propertyName);
// rename references
context.renameIdentifier(nameNode, propertyName);
// replace MethodInvocation with PropertyAccess

Powered by Google App Engine
This is Rietveld 408576698