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

Unified Diff: pkg/compiler/lib/src/source_file_provider.dart

Issue 925943002: Refactor SourceFile, SourceFileProvider and SourceLocation. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Updated cf. comments. Created 5 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 | « pkg/compiler/lib/src/io/source_map_builder.dart ('k') | pkg/compiler/lib/src/ssa/builder.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/compiler/lib/src/source_file_provider.dart
diff --git a/pkg/compiler/lib/src/source_file_provider.dart b/pkg/compiler/lib/src/source_file_provider.dart
index f254a5edddbbad49bdd282809f25429dde452eb8..d0bd1b9de54cb5338660fc08bbda07d926f25c6f 100644
--- a/pkg/compiler/lib/src/source_file_provider.dart
+++ b/pkg/compiler/lib/src/source_file_provider.dart
@@ -30,7 +30,7 @@ List<int> readAll(String filename) {
abstract class SourceFileProvider {
bool isWindows = (Platform.operatingSystem == 'windows');
Uri cwd = currentDirectory;
- Map<String, SourceFile> sourceFiles = <String, SourceFile>{};
+ Map<Uri, SourceFile> sourceFiles = <Uri, SourceFile>{};
int dartCharactersRead = 0;
Future<String> readStringFromUri(Uri resourceUri) {
@@ -62,8 +62,9 @@ abstract class SourceFileProvider {
"$detail");
}
dartCharactersRead += source.length;
- sourceFiles[resourceUri.toString()] =
- new CachingUtf8BytesSourceFile(relativizeUri(resourceUri), source);
+ sourceFiles[resourceUri] =
+ new CachingUtf8BytesSourceFile(
+ resourceUri, relativizeUri(resourceUri), source);
return new Future.value(source);
}
@@ -92,8 +93,9 @@ abstract class SourceFileProvider {
offset += contentPart.length;
}
dartCharactersRead += totalLength;
- sourceFiles[resourceUri.toString()] =
- new CachingUtf8BytesSourceFile(resourceUri.toString(), result);
+ sourceFiles[resourceUri] =
+ new CachingUtf8BytesSourceFile(
+ resourceUri, resourceUri.toString(), result);
return result;
});
}
@@ -202,7 +204,7 @@ class FormattingDiagnosticHandler {
if (uri == null) {
print('${color(message)}');
} else {
- SourceFile file = provider.sourceFiles[uri.toString()];
+ SourceFile file = provider.sourceFiles[uri];
if (file != null) {
print(file.getLocationMessage(
color(message), begin, end, colorize: color));
« no previous file with comments | « pkg/compiler/lib/src/io/source_map_builder.dart ('k') | pkg/compiler/lib/src/ssa/builder.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698