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

Unified Diff: tools/line_doc_comments.dart

Issue 132403010: big update to observe, template_binding, polymer (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 10 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 | « samples/third_party/todomvc/test/utils.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/line_doc_comments.dart
diff --git a/tools/line_doc_comments.dart b/tools/line_doc_comments.dart
index 855648aa423213b1fad5ef345caa25b7e006d0be..5f3448cf75565ca8f95a29009e6ca935a2748004 100755
--- a/tools/line_doc_comments.dart
+++ b/tools/line_doc_comments.dart
@@ -21,10 +21,10 @@ main(List<String> args) {
}
var dir = new Directory(args[0]);
- dir.list(recursive: true).listen(
+ dir.list(recursive: true, followLinks: false).listen(
(entity) {
if (entity is File) {
- var file = entity.name;
+ var file = entity.path;
if (path.extension(file) != '.dart') return;
fixFile(file);
}
@@ -33,10 +33,10 @@ main(List<String> args) {
void fixFile(String path) {
var file = new File(path);
- file.readAsLines().transform(fixContents).chain((fixed) {
+ file.readAsLines().then(fixContents).then((fixed) {
return new File(path).writeAsString(fixed);
}).then((file) {
- print(file.name);
+ print(file.path);
});
}
@@ -54,14 +54,24 @@ String fixContents(List<String> lines) {
line = null;
} else {
var match = blockLine.firstMatch(line);
- line = '$indent/// ${match[1]}';
+ var comment = match[1];
+ if (comment != '') {
+ line = '$indent/// $comment';
+ } else {
+ line = '$indent///';
+ }
}
} else {
// See if it's a one-line block comment like: /** Blah. */
var match = oneLineBlock.firstMatch(line);
if (match != null) {
- if (match[2] != '') {
- line = '${match[1]}/// ${match[2]}';
+ var comment = match[2];
+ if (comment != '') {
+ // Remove the extra space before the `*/`
+ if (comment.endsWith(' ')) {
+ comment = comment.substring(0, comment.length - 1);
+ }
+ line = '${match[1]}/// $comment';
} else {
line = '${match[1]}///';
}
« no previous file with comments | « samples/third_party/todomvc/test/utils.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698