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

Unified Diff: pkg/dartdoc/lib/src/dartdoc/comment_map.dart

Issue 10985085: Members and comments inherited in dartdoc. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Updated cf. comments Created 8 years, 2 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 | « pkg/dartdoc/lib/src/client/client-shared.dart ('k') | pkg/dartdoc/lib/src/mirrors/dart2js_mirror.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/dartdoc/lib/src/dartdoc/comment_map.dart
diff --git a/pkg/dartdoc/lib/src/dartdoc/comment_map.dart b/pkg/dartdoc/lib/src/dartdoc/comment_map.dart
index d86a71a79c1b9e35b7654248207f6443708c0340..406da4dcdaa31de3ada714934866be5ac1b7d665 100644
--- a/pkg/dartdoc/lib/src/dartdoc/comment_map.dart
+++ b/pkg/dartdoc/lib/src/dartdoc/comment_map.dart
@@ -23,24 +23,30 @@ class CommentMap {
: _comments = <String, Map<int, String>>{},
_libraryComments = <String, String>{};
- /** Finds the doc comment preceding the given source span, if there is one. */
+ /**
+ * Finds the doc comment preceding the given source span, if there is one.
+ *
+ * If a comment is returned, it is guaranteed to be non-empty.
+ */
String find(Location span) {
if (span == null) return null;
_ensureFileParsed(span.source);
- final comment = _comments[span.source.uri.toString()][span.start];
- if (comment == null) return '';
+ String comment = _comments[span.source.uri.toString()][span.start];
+ assert(comment == null || !comment.trim().isEmpty());
return comment;
}
/**
* Finds the doc comment associated with the `#library` directive for the
* given file.
+ *
+ * If a comment is returned, it is guaranteed to be non-empty.
*/
String findLibrary(Source source) {
_ensureFileParsed(source);
- final comment = _libraryComments[source.uri.toString()];
- if (comment == null) return '';
+ String comment = _libraryComments[source.uri.toString()];
+ assert(comment == null || !comment.trim().isEmpty());
return comment;
}
@@ -80,9 +86,11 @@ class CommentMap {
lastComment = null;
}
} else if (lastComment != null) {
- // We haven't attached the last doc comment to something yet, so stick
- // it to this token.
- comments[token.charOffset] = lastComment;
+ if (!lastComment.trim().isEmpty()) {
+ // We haven't attached the last doc comment to something yet, so stick
+ // it to this token.
+ comments[token.charOffset] = lastComment;
+ }
lastComment = null;
}
token = token.next;
« no previous file with comments | « pkg/dartdoc/lib/src/client/client-shared.dart ('k') | pkg/dartdoc/lib/src/mirrors/dart2js_mirror.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698