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

Unified Diff: pkg/analyzer/lib/file_system/physical_file_system.dart

Issue 2245133005: Convert resource providers to use FileSource (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Fix missed reference Created 4 years, 4 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/file_system/memory_file_system.dart ('k') | pkg/analyzer/lib/src/generated/source_io.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analyzer/lib/file_system/physical_file_system.dart
diff --git a/pkg/analyzer/lib/file_system/physical_file_system.dart b/pkg/analyzer/lib/file_system/physical_file_system.dart
index b37fd72f7a9275e3a4bbc9643bcd25cac11dc86b..3b02335b012fd745a0c545662432a8dd6c61d10d 100644
--- a/pkg/analyzer/lib/file_system/physical_file_system.dart
+++ b/pkg/analyzer/lib/file_system/physical_file_system.dart
@@ -9,8 +9,8 @@ import 'dart:core' hide Resource;
import 'dart:io' as io;
import 'package:analyzer/file_system/file_system.dart';
-import 'package:analyzer/src/generated/java_io.dart';
import 'package:analyzer/src/generated/source_io.dart';
+import 'package:analyzer/src/source/source_resource.dart';
import 'package:analyzer/src/util/absolute_path.dart';
import 'package:isolate/isolate_runner.dart';
import 'package:path/path.dart';
@@ -85,9 +85,7 @@ class PhysicalResourceProvider implements ResourceProvider {
@override
Future<List<int>> getModificationTimes(List<Source> sources) async {
- List<String> paths = sources
- .map((source) => source is FileBasedSource ? source.fullName : null)
- .toList();
+ List<String> paths = sources.map((source) => source.fullName).toList();
IsolateRunner runner = await pathsToTimesIsolateProvider.get();
return runner.run(_pathsToTimes, paths);
}
@@ -140,12 +138,7 @@ class _PhysicalFile extends _PhysicalResource implements File {
@override
Source createSource([Uri uri]) {
- io.File file = _entry as io.File;
- JavaFile javaFile = new JavaFile(file.absolute.path);
- if (uri == null) {
- uri = javaFile.toURI();
- }
- return new FileBasedSource(javaFile, uri);
+ return new FileSource(this, uri ?? pathContext.toUri(path));
}
@override
@@ -299,6 +292,11 @@ abstract class _PhysicalResource implements Resource {
@override
String get path => _entry.absolute.path;
+ /**
+ * Return the path context used by this resource provider.
+ */
+ Context get pathContext => io.Platform.isWindows ? windows : posix;
+
@override
String get shortName => absolutePathContext.basename(path);
« no previous file with comments | « pkg/analyzer/lib/file_system/memory_file_system.dart ('k') | pkg/analyzer/lib/src/generated/source_io.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698