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

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

Issue 11275097: Merge SourceLocation and Source (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Revert use of Pattern.allMatches Created 8 years, 1 month 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/mirrors_util.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 25240d49bbceb71e7de578b585bbd724c132ea1b..77b7e07f3e4831ef431455222fc1fa35229caea8 100644
--- a/pkg/dartdoc/lib/src/dartdoc/comment_map.dart
+++ b/pkg/dartdoc/lib/src/dartdoc/comment_map.dart
@@ -18,7 +18,7 @@ class CommentMap {
*/
Map<String, Map<int, String>> _comments;
- /** Doc comments before #library() directives. */
+ /** Doc comments before `library` directives. */
Map<String, String> _libraryComments;
CommentMap()
@@ -33,34 +33,34 @@ class CommentMap {
String find(SourceLocation span) {
if (span == null) return null;
- _ensureFileParsed(span.source);
- String comment = _comments[span.source.uri.toString()][span.start];
+ _ensureFileParsed(span);
+ String comment = _comments[span.sourceUri.toString()][span.offset];
assert(comment == null || !comment.trim().isEmpty);
return comment;
}
/**
- * Finds the doc comment associated with the `#library` directive for the
+ * 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) {
+ String findLibrary(SourceLocation source) {
_ensureFileParsed(source);
- String comment = _libraryComments[source.uri.toString()];
+ String comment = _libraryComments[source.sourceUri.toString()];
assert(comment == null || !comment.trim().isEmpty);
return comment;
}
- _ensureFileParsed(Source source) {
- _comments.putIfAbsent(source.uri.toString(), () =>
+ _ensureFileParsed(SourceLocation source) {
+ _comments.putIfAbsent(source.sourceUri.toString(), () =>
_parseComments(source));
}
- _parseComments(Source source) {
+ _parseComments(SourceLocation source) {
final comments = new Map<int, String>();
- final scanner = new dart2js.StringScanner(source.text,
+ final scanner = new dart2js.StringScanner(source.sourceText,
includeComments: true);
var lastComment = null;
@@ -82,10 +82,10 @@ class CommentMap {
}
}
} else if (token.kind == dart2js.HASH_TOKEN) {
- // Look for #library() to find the library comment.
+ // Look for `library` to find the library comment.
final next = token.next;
if ((lastComment != null) && (next.stringValue == 'library')) {
- _libraryComments[source.uri.toString()] = lastComment;
+ _libraryComments[source.sourceUri.toString()] = lastComment;
lastComment = null;
}
} else if (lastComment != null) {
« no previous file with comments | « pkg/dartdoc/lib/mirrors_util.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