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

Unified Diff: pkg/analyzer/lib/src/analyzer_impl.dart

Issue 428303004: Breaking changes in 'analyzer' package. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Rename Source.resolveRelative to resolveRelativeUri, soften version constraints Created 6 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/source/package_map_resolver.dart ('k') | pkg/analyzer/lib/src/generated/element.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analyzer/lib/src/analyzer_impl.dart
diff --git a/pkg/analyzer/lib/src/analyzer_impl.dart b/pkg/analyzer/lib/src/analyzer_impl.dart
index d6aa8b57d6d611aa886e05a19942b4ca27a64979..a2b8e13b26f21d7202f24addb5e178acbd65f7f1 100644
--- a/pkg/analyzer/lib/src/analyzer_impl.dart
+++ b/pkg/analyzer/lib/src/analyzer_impl.dart
@@ -8,8 +8,6 @@ import 'dart:async';
import 'dart:io';
-import 'package:path/path.dart' as pathos;
-
import 'generated/constant.dart';
import 'generated/engine.dart';
import 'generated/element.dart';
@@ -89,8 +87,8 @@ class AnalyzerImpl {
throw new ArgumentError("sourcePath cannot be null");
}
JavaFile sourceFile = new JavaFile(sourcePath);
- UriKind uriKind = getUriKind(sourceFile);
- librarySource = new FileBasedSource.con2(sourceFile, uriKind);
+ Uri uri = getUri(sourceFile);
+ librarySource = new FileBasedSource.con2(uri, sourceFile);
// prepare context
prepareAnalysisContext(sourceFile, librarySource);
@@ -347,26 +345,21 @@ class AnalyzerImpl {
}
/**
- * Returns the [UriKind] for the given input file. Usually {@link UriKind#FILE_URI}, but if
- * the given file is located in the "lib" directory of the [sdk], then returns
- * {@link UriKind#DART_URI}.
+ * Returns the [Uri] for the given input file.
+ *
+ * Usually it is a `file:` [Uri], but if [file] is located in the `lib`
+ * directory of the [sdk], then returns a `dart:` [Uri].
*/
- static UriKind getUriKind(JavaFile file) {
+ static Uri getUri(JavaFile file) {
// may be file in SDK
- if (sdk is DirectoryBasedDartSdk) {
- DirectoryBasedDartSdk directoryBasedSdk = sdk;
- var libraryDirectory = directoryBasedSdk.libraryDirectory.getAbsolutePath();
- var sdkLibPath = libraryDirectory + pathos.separator;
- var filePath = file.getPath();
- if (filePath.startsWith(sdkLibPath)) {
- var internalPath = pathos.join(libraryDirectory, '_internal') + pathos.separator;
- if (!filePath.startsWith(internalPath)) {
- return UriKind.DART_URI;
- }
+ {
+ Source source = sdk.fromFileUri(file.toURI());
+ if (source != null) {
+ return source.uri;
}
}
// some generic file
- return UriKind.FILE_URI;
+ return file.toURI();
}
}
« no previous file with comments | « pkg/analyzer/lib/source/package_map_resolver.dart ('k') | pkg/analyzer/lib/src/generated/element.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698