| Index: packages/analyzer/lib/src/generated/source.dart
|
| diff --git a/analyzer/lib/src/generated/source.dart b/packages/analyzer/lib/src/generated/source.dart
|
| similarity index 96%
|
| rename from analyzer/lib/src/generated/source.dart
|
| rename to packages/analyzer/lib/src/generated/source.dart
|
| index 5b96dbd83198b1dc52ff1558ed8587a746e93809..1a4751678597008be0e04437eaa118bd5e69fd35 100644
|
| --- a/analyzer/lib/src/generated/source.dart
|
| +++ b/packages/analyzer/lib/src/generated/source.dart
|
| @@ -2,9 +2,6 @@
|
| // for details. All rights reserved. Use of this source code is governed by a
|
| // BSD-style license that can be found in the LICENSE file.
|
|
|
| -// This code was auto-generated, is not intended to be edited, and is subject to
|
| -// significant change. Please see the README file for more information.
|
| -
|
| library engine.source;
|
|
|
| import 'dart:collection';
|
| @@ -109,7 +106,7 @@ class CustomUriResolver extends UriResolver {
|
| CustomUriResolver(this._urlMappings);
|
|
|
| @override
|
| - Source resolveAbsolute(Uri uri) {
|
| + Source resolveAbsolute(Uri uri, [Uri actualUri]) {
|
| String mapping = _urlMappings[uri.toString()];
|
| if (mapping == null) return null;
|
|
|
| @@ -117,7 +114,7 @@ class CustomUriResolver extends UriResolver {
|
| if (!fileUri.isAbsolute) return null;
|
|
|
| JavaFile javaFile = new JavaFile.fromUri(fileUri);
|
| - return new FileBasedSource(javaFile);
|
| + return new FileBasedSource(javaFile, actualUri != null ? actualUri : uri);
|
| }
|
| }
|
|
|
| @@ -156,7 +153,7 @@ class DartUriResolver extends UriResolver {
|
| DartSdk get dartSdk => _sdk;
|
|
|
| @override
|
| - Source resolveAbsolute(Uri uri) {
|
| + Source resolveAbsolute(Uri uri, [Uri actualUri]) {
|
| if (!isDartUri(uri)) {
|
| return null;
|
| }
|
| @@ -275,6 +272,9 @@ class LineInfo_Location {
|
| * @param columnNumber the one-based index of the column containing the character
|
| */
|
| LineInfo_Location(this.lineNumber, this.columnNumber);
|
| +
|
| + @override
|
| + String toString() => '$lineNumber:$columnNumber';
|
| }
|
|
|
| /**
|
| @@ -605,8 +605,8 @@ class SourceFactory {
|
| SourceFactory(this._resolvers,
|
| [this._packages, ResourceProvider resourceProvider])
|
| : _resourceProvider = resourceProvider != null
|
| - ? resourceProvider
|
| - : PhysicalResourceProvider.INSTANCE;
|
| + ? resourceProvider
|
| + : PhysicalResourceProvider.INSTANCE;
|
|
|
| /**
|
| * Return the [DartSdk] associated with this [SourceFactory], or `null` if there
|
| @@ -642,16 +642,17 @@ class SourceFactory {
|
| Map<String, List<Folder>> packageMap = <String, List<Folder>>{};
|
| _packages.asMap().forEach((String name, Uri uri) {
|
| if (uri.scheme == 'file' || uri.scheme == '' /* unspecified */) {
|
| - packageMap[name] =
|
| - <Folder>[_resourceProvider.getFolder(uri.toFilePath())];
|
| + packageMap[name] = <Folder>[
|
| + _resourceProvider.getFolder(uri.toFilePath())
|
| + ];
|
| }
|
| });
|
| return packageMap;
|
| }
|
|
|
| // Default to the PackageMapUriResolver.
|
| - PackageMapUriResolver resolver = _resolvers.firstWhere(
|
| - (r) => r is PackageMapUriResolver, orElse: () => null);
|
| + PackageMapUriResolver resolver = _resolvers
|
| + .firstWhere((r) => r is PackageMapUriResolver, orElse: () => null);
|
| return resolver != null ? resolver.packageMap : null;
|
| }
|
|
|
| @@ -814,22 +815,30 @@ class SourceFactory {
|
| }
|
| containedUri = containingSource.resolveRelativeUri(containedUri);
|
| }
|
| - // Now check .packages.
|
| +
|
| + Uri actualUri = containedUri;
|
| +
|
| + // Check .packages and update target and actual URIs as appropriate.
|
| if (_packages != null && containedUri.scheme == 'package') {
|
| Uri packageUri =
|
| _packages.resolve(containedUri, notFound: (Uri packageUri) => null);
|
| - // Ensure scheme is set.
|
| - if (packageUri != null && packageUri.scheme == '') {
|
| - packageUri = packageUri.replace(scheme: 'file');
|
| +
|
| + if (packageUri != null) {
|
| + // Ensure scheme is set.
|
| + if (packageUri.scheme == '') {
|
| + packageUri = packageUri.replace(scheme: 'file');
|
| + }
|
| + containedUri = packageUri;
|
| }
|
| - containedUri = packageUri;
|
| }
|
| +
|
| for (UriResolver resolver in _resolvers) {
|
| - Source result = resolver.resolveAbsolute(containedUri);
|
| + Source result = resolver.resolveAbsolute(containedUri, actualUri);
|
| if (result != null) {
|
| return result;
|
| }
|
| }
|
| +
|
| return null;
|
| }
|
| }
|
| @@ -1062,16 +1071,16 @@ abstract class UriResolver {
|
| * resolved because the URI is invalid.
|
| *
|
| * @param uri the URI to be resolved
|
| + * @param actualUri the actual uri for this source -- if `null`, the value of [uri] will be used
|
| * @return a [Source] representing the file to which given URI was resolved
|
| */
|
| - Source resolveAbsolute(Uri uri);
|
| + Source resolveAbsolute(Uri uri, [Uri actualUri]);
|
|
|
| /**
|
| - * Return an absolute URI that represents the given source, or `null` if a valid URI cannot
|
| - * be computed.
|
| + * Return an absolute URI that represents the given [source], or `null` if a
|
| + * valid URI cannot be computed.
|
| *
|
| - * @param source the source to get URI for
|
| - * @return the absolute URI representing the given source
|
| + * The computation should be based solely on [source.fullName].
|
| */
|
| Uri restoreAbsolute(Source source) => null;
|
| }
|
|
|