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

Unified Diff: pkg/front_end/lib/src/incremental/file_state.dart

Issue 2890883002: Fix for resolving 'bar.dart' against 'dart:foo'. Test for TranslateUri. (Closed)
Patch Set: Created 3 years, 7 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/front_end/lib/src/fasta/translate_uri.dart ('k') | pkg/front_end/test/fasta/translate_uri_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/front_end/lib/src/incremental/file_state.dart
diff --git a/pkg/front_end/lib/src/incremental/file_state.dart b/pkg/front_end/lib/src/incremental/file_state.dart
index a0bbb71a631d3514fee4a64db8e2dcfecf1efd14..accbdcf42f4ba6979150f2cde770188c12ae8fc6 100644
--- a/pkg/front_end/lib/src/incremental/file_state.dart
+++ b/pkg/front_end/lib/src/incremental/file_state.dart
@@ -7,6 +7,7 @@ import 'dart:typed_data';
import 'package:crypto/crypto.dart';
import 'package:front_end/file_system.dart';
+import 'package:front_end/src/base/resolve_relative_uri.dart';
import 'package:front_end/src/dependency_walker.dart' as graph;
import 'package:front_end/src/fasta/parser/dart_vm_native.dart';
import 'package:front_end/src/fasta/parser/top_level_parser.dart';
@@ -167,8 +168,8 @@ class FileState {
@override
String toString() {
- if (fileUri.scheme == 'file') return fileUri.path;
- return fileUri.toString();
+ if (uri.scheme == 'file') return uri.path;
+ return uri.toString();
}
/// Fasta unconditionally loads all VM libraries. In order to be able to
@@ -197,7 +198,7 @@ class FileState {
// 2) The absolute non-file URI, e.g. `package:foo/foo.dart`.
Uri absoluteUri;
try {
- absoluteUri = fileUri.resolve(relativeUri);
+ absoluteUri = resolveRelativeUri(uri, Uri.parse(relativeUri));
} on FormatException {
return null;
}
@@ -221,6 +222,9 @@ class FileSystemState {
_FileSystemView _fileSystemView;
/// Mapping from file URIs to corresponding [FileState]s.
+ final Map<Uri, FileState> _uriToFile = {};
+
+ /// Mapping from file URIs to corresponding [FileState]s.
final Map<Uri, FileState> _fileUriToFile = {};
FileSystemState(this.fileSystem, this.uriTranslator);
@@ -247,10 +251,10 @@ class FileSystemState {
if (fileUri == null) return null;
}
- FileState file = _fileUriToFile[absoluteUri];
+ FileState file = _uriToFile[absoluteUri];
if (file == null) {
file = new FileState._(this, absoluteUri, fileUri);
- _fileUriToFile[absoluteUri] = file;
+ _uriToFile[absoluteUri] = file;
_fileUriToFile[fileUri] = file;
// Build the sub-graph of the file.
« no previous file with comments | « pkg/front_end/lib/src/fasta/translate_uri.dart ('k') | pkg/front_end/test/fasta/translate_uri_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698