| Index: pkg/analyzer/lib/src/summary/package_bundle_reader.dart
|
| diff --git a/pkg/analyzer/lib/src/summary/package_bundle_reader.dart b/pkg/analyzer/lib/src/summary/package_bundle_reader.dart
|
| index 7ea1c1b8c66e42b759dae63e294fcbf96cfb2aaf..719dbab1ce9eab67e61b961c93b9b053d956b693 100644
|
| --- a/pkg/analyzer/lib/src/summary/package_bundle_reader.dart
|
| +++ b/pkg/analyzer/lib/src/summary/package_bundle_reader.dart
|
| @@ -1,6 +1,7 @@
|
| import 'dart:io' as io;
|
|
|
| import 'package:analyzer/dart/element/element.dart';
|
| +import 'package:analyzer/file_system/file_system.dart';
|
| import 'package:analyzer/src/context/cache.dart';
|
| import 'package:analyzer/src/context/context.dart';
|
| import 'package:analyzer/src/dart/element/element.dart';
|
| @@ -10,6 +11,7 @@ import 'package:analyzer/src/generated/resolver.dart';
|
| import 'package:analyzer/src/generated/source.dart';
|
| import 'package:analyzer/src/generated/source_io.dart';
|
| import 'package:analyzer/src/generated/utilities_dart.dart';
|
| +import 'package:analyzer/src/source/source_resource.dart';
|
| import 'package:analyzer/src/summary/format.dart';
|
| import 'package:analyzer/src/summary/idl.dart';
|
| import 'package:analyzer/src/summary/resynthesize.dart';
|
| @@ -41,9 +43,8 @@ class InputPackagesResultProvider extends ResynthesizerResultProvider {
|
| /**
|
| * The [UriResolver] that knows about sources that are served from their
|
| * summaries.
|
| - *
|
| - * TODO(scheglov) rename to `InSummaryUriResolver` - it's not `package:` specific.
|
| */
|
| +@deprecated
|
| class InSummaryPackageUriResolver extends UriResolver {
|
| final SummaryDataStore _dataStore;
|
|
|
| @@ -117,6 +118,36 @@ class InSummarySource extends Source {
|
| }
|
|
|
| /**
|
| + * The [UriResolver] that knows about sources that are served from their
|
| + * summaries.
|
| + */
|
| +class InSummaryUriResolver extends UriResolver {
|
| + ResourceProvider resourceProvider;
|
| + final SummaryDataStore _dataStore;
|
| +
|
| + InSummaryUriResolver(this.resourceProvider, this._dataStore);
|
| +
|
| + @override
|
| + Source resolveAbsolute(Uri uri, [Uri actualUri]) {
|
| + actualUri ??= uri;
|
| + String uriString = uri.toString();
|
| + UnlinkedUnit unit = _dataStore.unlinkedMap[uriString];
|
| + if (unit != null) {
|
| + String summaryPath = _dataStore.uriToSummaryPath[uriString];
|
| + if (unit.fallbackModePath.isNotEmpty) {
|
| + return new _InSummaryFallbackFileSource(
|
| + resourceProvider.getFile(unit.fallbackModePath),
|
| + actualUri,
|
| + summaryPath);
|
| + } else {
|
| + return new InSummarySource(actualUri, summaryPath);
|
| + }
|
| + }
|
| + return null;
|
| + }
|
| +}
|
| +
|
| +/**
|
| * The [ResultProvider] that provides results using summary resynthesizer.
|
| */
|
| abstract class ResynthesizerResultProvider extends ResultProvider {
|
| @@ -427,9 +458,24 @@ class _FileBasedSummaryResynthesizer extends SummaryResynthesizer {
|
|
|
| /**
|
| * A source that is part of a package whose summary was generated in fallback
|
| - * mode. This source behaves identically to a [FileBasedSource] except that it
|
| + * mode. This source behaves identically to a [FileSource] except that it also
|
| + * provides [summaryPath].
|
| + */
|
| +class _InSummaryFallbackFileSource extends FileSource
|
| + implements InSummarySource {
|
| + @override
|
| + final String summaryPath;
|
| +
|
| + _InSummaryFallbackFileSource(File file, Uri uri, this.summaryPath)
|
| + : super(file, uri);
|
| +}
|
| +
|
| +/**
|
| + * A source that is part of a package whose summary was generated in fallback
|
| + * mode. This source behaves identically to a [FileBasedSource] except that it
|
| * also provides [summaryPath].
|
| */
|
| +@deprecated
|
| class _InSummaryFallbackSource extends FileBasedSource
|
| implements InSummarySource {
|
| @override
|
|
|