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

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: 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
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 27dd1dd1f2b5dec99ceb7d20cb0ce5cd5ea8b900..8f5894085bb20216e37add451bc9fe4a5f340696 100644
--- a/pkg/dartdoc/lib/src/dartdoc/comment_map.dart
+++ b/pkg/dartdoc/lib/src/dartdoc/comment_map.dart
@@ -31,8 +31,8 @@ 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;
}
@@ -43,22 +43,22 @@ class CommentMap {
*
* 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;
@@ -83,7 +83,7 @@ class CommentMap {
// 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) {

Powered by Google App Engine
This is Rietveld 408576698