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

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

Issue 16256021: Remove trailing spaces in analyzer_experimental (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 7 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
« no previous file with comments | « no previous file | pkg/analyzer_experimental/lib/src/generated/ast.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: editor/util/plugins/com.google.dart.java2dart/src/com/google/dart/java2dart/engine/MainEngine.java
diff --git a/editor/util/plugins/com.google.dart.java2dart/src/com/google/dart/java2dart/engine/MainEngine.java b/editor/util/plugins/com.google.dart.java2dart/src/com/google/dart/java2dart/engine/MainEngine.java
index bb9dbf75fdae3d4ceffe445948fba5412f12e1ae..84eb887cb69539443f7a58f70f3b79ce4b4a4189 100644
--- a/editor/util/plugins/com.google.dart.java2dart/src/com/google/dart/java2dart/engine/MainEngine.java
+++ b/editor/util/plugins/com.google.dart.java2dart/src/com/google/dart/java2dart/engine/MainEngine.java
@@ -1031,7 +1031,9 @@ public class MainEngine {
PrintStringWriter writer = new PrintStringWriter();
writer.append(HEADER);
node.accept(new ToFormattedSourceVisitor(writer));
- return writer.toString();
+ String source = writer.toString();
+ source = removeTrailingWhitespaces(source);
+ return source;
}
/**
@@ -1051,4 +1053,15 @@ public class MainEngine {
return file.getAbsolutePath().startsWith(
engineTestFolder.getAbsolutePath() + "/com/google/dart/engine/" + enginePackage);
}
+
+ /**
+ * Removes trailing spaces from the given Dart source.
+ */
+ private static String removeTrailingWhitespaces(String source) {
+ String[] lines = StringUtils.split(source, '\n');
+ for (int i = 0; i < lines.length; i++) {
+ lines[i] = StringUtils.stripEnd(lines[i], null);
+ }
+ return StringUtils.join(lines, "\n");
+ }
}
« no previous file with comments | « no previous file | pkg/analyzer_experimental/lib/src/generated/ast.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698