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

Unified Diff: pkg/analyzer/lib/src/generated/source_io.dart

Issue 137863002: Issue 8742. Preserve leading line comments during java2dart translation. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Test for block-style comment translation. Created 6 years, 11 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/analyzer/lib/src/generated/source.dart ('k') | pkg/analyzer/pubspec.yaml » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analyzer/lib/src/generated/source_io.dart
diff --git a/pkg/analyzer/lib/src/generated/source_io.dart b/pkg/analyzer/lib/src/generated/source_io.dart
index bde6b54d1f48c7a41cb7edf1982a208ed7235aeb..00682395d4c63c45269ffdbb983d1d522a5ce54f 100644
--- a/pkg/analyzer/lib/src/generated/source_io.dart
+++ b/pkg/analyzer/lib/src/generated/source_io.dart
@@ -111,11 +111,17 @@ class FileBasedSource implements Source {
bool exists() => _contentCache.getContents(this) != null || (_file.exists() && !_file.isDirectory());
void getContents(Source_ContentReceiver receiver) {
+ //
+ // First check to see whether our content cache has an override for our contents.
+ //
String contents = _contentCache.getContents(this);
if (contents != null) {
receiver.accept2(contents, _contentCache.getModificationStamp(this));
return;
}
+ //
+ // If not, read the contents from the file using native I/O.
+ //
getContentsFromFile(receiver);
}
@@ -255,11 +261,14 @@ class PackageUriResolver extends UriResolver {
String relPath;
int index = path.indexOf('/');
if (index == -1) {
+ // No slash
pkgName = path;
relPath = "";
} else if (index == 0) {
+ // Leading slash is invalid
return null;
} else {
+ // <pkgName>/<relPath>
pkgName = path.substring(0, index);
relPath = path.substring(index + 1);
}
« no previous file with comments | « pkg/analyzer/lib/src/generated/source.dart ('k') | pkg/analyzer/pubspec.yaml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698