Use single InputPackagesResultProvider, without SdkSummaryResultProvider.
Each SummaryResynthesizer is now responsible for creating its TypeProvider. And with the new AnalysisDriver we stop using SDK CachePartition. For now we add SDK's summary bundle into SummaryDataStore. Eventually we will get rid of it and add individual SDK libraries. R=brianwilkerson@google.com, paulberry@google.com, vsm@google.com BUG= Review-Url: https://codereview.chromium.org/2652823002 .
This commit is contained in:
@@ -1011,6 +1011,9 @@ class FixProcessor {
|
||||
}
|
||||
staticModifier = _inStaticContext();
|
||||
}
|
||||
if (targetClassElement.librarySource.isInSystemLibrary) {
|
||||
return;
|
||||
}
|
||||
utils.targetClassElement = targetClassElement;
|
||||
// prepare target ClassDeclaration
|
||||
AstNode targetTypeNode = getParsedClassElementNode(targetClassElement);
|
||||
@@ -1144,6 +1147,9 @@ class FixProcessor {
|
||||
}
|
||||
staticModifier = _inStaticContext();
|
||||
}
|
||||
if (targetClassElement.librarySource.isInSystemLibrary) {
|
||||
return;
|
||||
}
|
||||
utils.targetClassElement = targetClassElement;
|
||||
// prepare target ClassDeclaration
|
||||
AstNode targetTypeNode = getParsedClassElementNode(targetClassElement);
|
||||
@@ -2014,6 +2020,9 @@ class FixProcessor {
|
||||
return;
|
||||
}
|
||||
ClassElement targetClassElement = targetType.element as ClassElement;
|
||||
if (targetClassElement.librarySource.isInSystemLibrary) {
|
||||
return;
|
||||
}
|
||||
targetElement = targetClassElement;
|
||||
// prepare target ClassDeclaration
|
||||
AstNode targetTypeNode = getParsedClassElementNode(targetClassElement);
|
||||
|
||||
@@ -204,6 +204,15 @@ class AnalysisContextImpl implements InternalAnalysisContext {
|
||||
*/
|
||||
List<AnalysisListener> _listeners = new List<AnalysisListener>();
|
||||
|
||||
/**
|
||||
* Determines whether this context should attempt to make use of the global
|
||||
* SDK cache partition. Note that if this context is responsible for
|
||||
* resynthesizing the SDK element model, this flag should be set to `false`,
|
||||
* so that resynthesized elements belonging to this context won't leak into
|
||||
* the global SDK cache partition.
|
||||
*/
|
||||
bool useSdkCachePartition = true;
|
||||
|
||||
@override
|
||||
ResultProvider resultProvider;
|
||||
|
||||
@@ -739,6 +748,9 @@ class AnalysisContextImpl implements InternalAnalysisContext {
|
||||
if (factory == null) {
|
||||
return new AnalysisCache(<CachePartition>[_privatePartition]);
|
||||
}
|
||||
if (!useSdkCachePartition) {
|
||||
return new AnalysisCache(<CachePartition>[_privatePartition]);
|
||||
}
|
||||
DartSdk sdk = factory.dartSdk;
|
||||
if (sdk == null) {
|
||||
return new AnalysisCache(<CachePartition>[_privatePartition]);
|
||||
|
||||
@@ -757,6 +757,7 @@ class AnalysisDriver {
|
||||
AnalysisContext _createAnalysisContext(_LibraryContext libraryContext) {
|
||||
AnalysisContextImpl analysisContext =
|
||||
AnalysisEngine.instance.createAnalysisContext();
|
||||
analysisContext.useSdkCachePartition = false;
|
||||
analysisContext.analysisOptions = _analysisOptions;
|
||||
analysisContext.sourceFactory = _sourceFactory.clone();
|
||||
analysisContext.contentCache = new _ContentCacheWrapper(_fsState);
|
||||
|
||||
@@ -22,7 +22,7 @@ import 'package:analyzer/src/generated/parser.dart';
|
||||
import 'package:analyzer/src/generated/sdk.dart';
|
||||
import 'package:analyzer/src/generated/source_io.dart';
|
||||
import 'package:analyzer/src/summary/idl.dart' show PackageBundle;
|
||||
import 'package:analyzer/src/summary/summary_sdk.dart';
|
||||
import 'package:analyzer/src/summary/package_bundle_reader.dart';
|
||||
import 'package:path/path.dart' as pathos;
|
||||
import 'package:yaml/yaml.dart';
|
||||
|
||||
@@ -89,11 +89,12 @@ abstract class AbstractDartSdk implements DartSdk {
|
||||
SourceFactory factory = new SourceFactory([new DartUriResolver(this)]);
|
||||
_analysisContext.sourceFactory = factory;
|
||||
if (_useSummary) {
|
||||
bool strongMode = _analysisOptions?.strongMode ?? false;
|
||||
PackageBundle sdkBundle = getLinkedBundle();
|
||||
if (sdkBundle != null) {
|
||||
_analysisContext.resultProvider = new SdkSummaryResultProvider(
|
||||
_analysisContext, sdkBundle, strongMode);
|
||||
SummaryDataStore dataStore = new SummaryDataStore([]);
|
||||
dataStore.addBundle(null, sdkBundle);
|
||||
_analysisContext.resultProvider =
|
||||
new InputPackagesResultProvider(_analysisContext, dataStore);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,7 +21,7 @@ import 'package:analyzer/src/generated/parser.dart';
|
||||
import 'package:analyzer/src/generated/sdk.dart';
|
||||
import 'package:analyzer/src/generated/source_io.dart';
|
||||
import 'package:analyzer/src/summary/idl.dart' show PackageBundle;
|
||||
import 'package:analyzer/src/summary/summary_sdk.dart';
|
||||
import 'package:analyzer/src/summary/package_bundle_reader.dart';
|
||||
import 'package:path/path.dart' as pathos;
|
||||
|
||||
/**
|
||||
@@ -79,8 +79,10 @@ abstract class AbstractDartSdk implements DartSdk {
|
||||
bool strongMode = _analysisOptions?.strongMode ?? false;
|
||||
PackageBundle sdkBundle = getSummarySdkBundle(strongMode);
|
||||
if (sdkBundle != null) {
|
||||
_analysisContext.resultProvider = new SdkSummaryResultProvider(
|
||||
_analysisContext, sdkBundle, strongMode);
|
||||
SummaryDataStore dataStore = new SummaryDataStore([]);
|
||||
dataStore.addBundle(null, sdkBundle);
|
||||
_analysisContext.resultProvider =
|
||||
new InputPackagesResultProvider(_analysisContext, dataStore);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@ import 'package:analyzer/src/context/cache.dart';
|
||||
import 'package:analyzer/src/context/context.dart';
|
||||
import 'package:analyzer/src/dart/element/element.dart';
|
||||
import 'package:analyzer/src/generated/engine.dart';
|
||||
import 'package:analyzer/src/generated/resolver.dart';
|
||||
import 'package:analyzer/src/generated/resolver.dart' show TypeProvider;
|
||||
import 'package:analyzer/src/generated/source.dart';
|
||||
import 'package:analyzer/src/generated/source_io.dart';
|
||||
import 'package:analyzer/src/generated/utilities_dart.dart';
|
||||
@@ -27,8 +27,8 @@ class InputPackagesResultProvider extends ResynthesizerResultProvider {
|
||||
InputPackagesResultProvider(
|
||||
InternalAnalysisContext context, SummaryDataStore dataStore)
|
||||
: super(context, dataStore) {
|
||||
AnalysisContext sdkContext = context.sourceFactory.dartSdk.context;
|
||||
createResynthesizer(sdkContext, sdkContext.typeProvider);
|
||||
createResynthesizer();
|
||||
context.typeProvider = resynthesizer.typeProvider;
|
||||
}
|
||||
|
||||
@override
|
||||
@@ -121,7 +121,6 @@ abstract class ResynthesizerResultProvider extends ResultProvider {
|
||||
final SummaryDataStore _dataStore;
|
||||
|
||||
_FileBasedSummaryResynthesizer _resynthesizer;
|
||||
ResynthesizerResultProvider _sdkProvider;
|
||||
|
||||
ResynthesizerResultProvider(this.context, this._dataStore);
|
||||
|
||||
@@ -136,10 +135,13 @@ abstract class ResynthesizerResultProvider extends ResultProvider {
|
||||
|
||||
@override
|
||||
bool compute(CacheEntry entry, ResultDescriptor result) {
|
||||
if (_sdkProvider != null && _sdkProvider.compute(entry, result)) {
|
||||
AnalysisTarget target = entry.target;
|
||||
|
||||
if (result == TYPE_PROVIDER) {
|
||||
entry.setValue(result as ResultDescriptor<TypeProvider>,
|
||||
_resynthesizer.typeProvider, TargetedResult.EMPTY_LIST);
|
||||
return true;
|
||||
}
|
||||
AnalysisTarget target = entry.target;
|
||||
|
||||
// LINE_INFO can be provided using just the UnlinkedUnit.
|
||||
if (target is Source && result == LINE_INFO) {
|
||||
@@ -264,19 +266,9 @@ abstract class ResynthesizerResultProvider extends ResultProvider {
|
||||
*
|
||||
* Subclasses must call this method in their constructors.
|
||||
*/
|
||||
void createResynthesizer(
|
||||
InternalAnalysisContext sdkContext, TypeProvider typeProvider) {
|
||||
// Set the type provider to prevent the context from computing it.
|
||||
context.typeProvider = typeProvider;
|
||||
// Create a chained resynthesizer.
|
||||
_sdkProvider = sdkContext?.resultProvider;
|
||||
_resynthesizer = new _FileBasedSummaryResynthesizer(
|
||||
_sdkProvider?.resynthesizer,
|
||||
context,
|
||||
typeProvider,
|
||||
context.sourceFactory,
|
||||
context.analysisOptions.strongMode,
|
||||
_dataStore);
|
||||
void createResynthesizer() {
|
||||
_resynthesizer = new _FileBasedSummaryResynthesizer(context,
|
||||
context.sourceFactory, context.analysisOptions.strongMode, _dataStore);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -428,14 +420,9 @@ class SummaryDataStore {
|
||||
class _FileBasedSummaryResynthesizer extends SummaryResynthesizer {
|
||||
final SummaryDataStore _dataStore;
|
||||
|
||||
_FileBasedSummaryResynthesizer(
|
||||
SummaryResynthesizer parent,
|
||||
AnalysisContext context,
|
||||
TypeProvider typeProvider,
|
||||
SourceFactory sourceFactory,
|
||||
bool strongMode,
|
||||
this._dataStore)
|
||||
: super(parent, context, typeProvider, sourceFactory, strongMode);
|
||||
_FileBasedSummaryResynthesizer(AnalysisContext context,
|
||||
SourceFactory sourceFactory, bool strongMode, this._dataStore)
|
||||
: super(null, context, sourceFactory, strongMode);
|
||||
|
||||
@override
|
||||
LinkedLibrary getLinkedSummary(String uri) {
|
||||
|
||||
@@ -22,6 +22,7 @@ import 'package:analyzer/src/generated/testing/ast_test_factory.dart';
|
||||
import 'package:analyzer/src/generated/testing/token_factory.dart';
|
||||
import 'package:analyzer/src/summary/format.dart';
|
||||
import 'package:analyzer/src/summary/idl.dart';
|
||||
import 'package:analyzer/src/summary/summary_sdk.dart';
|
||||
|
||||
/**
|
||||
* Implementation of [ElementResynthesizer] used when resynthesizing an element
|
||||
@@ -46,10 +47,9 @@ abstract class SummaryResynthesizer extends ElementResynthesizer {
|
||||
final Map<String, Source> _sources = <String, Source>{};
|
||||
|
||||
/**
|
||||
* The [TypeProvider] used to obtain core types (such as Object, int, List,
|
||||
* and dynamic) during resynthesis.
|
||||
* The [TypeProvider] used to obtain SDK types during resynthesis.
|
||||
*/
|
||||
final TypeProvider typeProvider;
|
||||
TypeProvider _typeProvider;
|
||||
|
||||
/**
|
||||
* Indicates whether the summary should be resynthesized assuming strong mode
|
||||
@@ -80,9 +80,11 @@ abstract class SummaryResynthesizer extends ElementResynthesizer {
|
||||
final Map<String, LibraryElement> _resynthesizedLibraries =
|
||||
<String, LibraryElement>{};
|
||||
|
||||
SummaryResynthesizer(this.parent, AnalysisContext context, this.typeProvider,
|
||||
this.sourceFactory, this.strongMode)
|
||||
: super(context);
|
||||
SummaryResynthesizer(
|
||||
this.parent, AnalysisContext context, this.sourceFactory, this.strongMode)
|
||||
: super(context) {
|
||||
_buildTypeProvider();
|
||||
}
|
||||
|
||||
/**
|
||||
* Number of libraries that have been resynthesized so far.
|
||||
@@ -90,14 +92,9 @@ abstract class SummaryResynthesizer extends ElementResynthesizer {
|
||||
int get resynthesisCount => _resynthesizedLibraries.length;
|
||||
|
||||
/**
|
||||
* Perform delayed finalization of the `dart:core` and `dart:async` libraries.
|
||||
* The [TypeProvider] used to obtain SDK types during resynthesis.
|
||||
*/
|
||||
void finalizeCoreAsyncLibraries() {
|
||||
(_resynthesizedLibraries['dart:core'] as LibraryElementImpl)
|
||||
.createLoadLibraryFunction(typeProvider);
|
||||
(_resynthesizedLibraries['dart:async'] as LibraryElementImpl)
|
||||
.createLoadLibraryFunction(typeProvider);
|
||||
}
|
||||
TypeProvider get typeProvider => _typeProvider;
|
||||
|
||||
@override
|
||||
Element getElement(ElementLocation location) {
|
||||
@@ -267,6 +264,17 @@ abstract class SummaryResynthesizer extends ElementResynthesizer {
|
||||
*/
|
||||
bool hasLibrarySummary(String uri);
|
||||
|
||||
void _buildTypeProvider() {
|
||||
var coreLibrary = getLibraryElement('dart:core') as LibraryElementImpl;
|
||||
var asyncLibrary = getLibraryElement('dart:async') as LibraryElementImpl;
|
||||
SummaryTypeProvider summaryTypeProvider = new SummaryTypeProvider();
|
||||
summaryTypeProvider.initializeCore(coreLibrary);
|
||||
summaryTypeProvider.initializeAsync(asyncLibrary);
|
||||
coreLibrary.createLoadLibraryFunction(summaryTypeProvider);
|
||||
asyncLibrary.createLoadLibraryFunction(summaryTypeProvider);
|
||||
_typeProvider = summaryTypeProvider;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the [LinkedLibrary] for the given [uri] or return `null` if it
|
||||
* could not be found.
|
||||
|
||||
@@ -7,7 +7,6 @@ library analyzer.src.summary.summary_sdk;
|
||||
import 'package:analyzer/dart/element/element.dart';
|
||||
import 'package:analyzer/dart/element/type.dart';
|
||||
import 'package:analyzer/file_system/file_system.dart' show ResourceProvider;
|
||||
import 'package:analyzer/src/context/cache.dart' show CacheEntry;
|
||||
import 'package:analyzer/src/context/context.dart';
|
||||
import 'package:analyzer/src/dart/element/type.dart';
|
||||
import 'package:analyzer/src/generated/constant.dart';
|
||||
@@ -18,84 +17,6 @@ import 'package:analyzer/src/generated/source.dart'
|
||||
show DartUriResolver, Source, SourceFactory;
|
||||
import 'package:analyzer/src/summary/idl.dart';
|
||||
import 'package:analyzer/src/summary/package_bundle_reader.dart';
|
||||
import 'package:analyzer/src/summary/resynthesize.dart';
|
||||
import 'package:analyzer/src/task/dart.dart';
|
||||
import 'package:analyzer/task/model.dart' show ResultDescriptor, TargetedResult;
|
||||
|
||||
class SdkSummaryResultProvider extends ResynthesizerResultProvider {
|
||||
final SummaryTypeProvider typeProvider = new SummaryTypeProvider();
|
||||
|
||||
SdkSummaryResultProvider(
|
||||
InternalAnalysisContext context, PackageBundle bundle, bool strongMode)
|
||||
: super(context, new SummaryDataStore(const <String>[])) {
|
||||
addBundle(null, bundle);
|
||||
createResynthesizer(null, typeProvider);
|
||||
_buildCoreLibrary();
|
||||
_buildAsyncLibrary();
|
||||
resynthesizer.finalizeCoreAsyncLibraries();
|
||||
context.typeProvider = typeProvider;
|
||||
}
|
||||
|
||||
@override
|
||||
bool compute(CacheEntry entry, ResultDescriptor result) {
|
||||
if (result == TYPE_PROVIDER) {
|
||||
entry.setValue(result as ResultDescriptor<TypeProvider>, typeProvider,
|
||||
TargetedResult.EMPTY_LIST);
|
||||
return true;
|
||||
}
|
||||
return super.compute(entry, result);
|
||||
}
|
||||
|
||||
@override
|
||||
bool hasResultsForSource(Source source) {
|
||||
return source != null && source.isInSystemLibrary;
|
||||
}
|
||||
|
||||
void _buildAsyncLibrary() {
|
||||
LibraryElement library = resynthesizer.getLibraryElement('dart:async');
|
||||
typeProvider.initializeAsync(library);
|
||||
}
|
||||
|
||||
void _buildCoreLibrary() {
|
||||
LibraryElement library = resynthesizer.getLibraryElement('dart:core');
|
||||
typeProvider.initializeCore(library);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* The implementation of [SummaryResynthesizer] for Dart SDK.
|
||||
*/
|
||||
class SdkSummaryResynthesizer extends SummaryResynthesizer {
|
||||
final PackageBundle bundle;
|
||||
final Map<String, UnlinkedUnit> unlinkedSummaries = <String, UnlinkedUnit>{};
|
||||
final Map<String, LinkedLibrary> linkedSummaries = <String, LinkedLibrary>{};
|
||||
|
||||
SdkSummaryResynthesizer(AnalysisContext context, TypeProvider typeProvider,
|
||||
SourceFactory sourceFactory, this.bundle, bool strongMode)
|
||||
: super(null, context, typeProvider, sourceFactory, strongMode) {
|
||||
for (int i = 0; i < bundle.unlinkedUnitUris.length; i++) {
|
||||
unlinkedSummaries[bundle.unlinkedUnitUris[i]] = bundle.unlinkedUnits[i];
|
||||
}
|
||||
for (int i = 0; i < bundle.linkedLibraryUris.length; i++) {
|
||||
linkedSummaries[bundle.linkedLibraryUris[i]] = bundle.linkedLibraries[i];
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
LinkedLibrary getLinkedSummary(String uri) {
|
||||
return linkedSummaries[uri];
|
||||
}
|
||||
|
||||
@override
|
||||
UnlinkedUnit getUnlinkedSummary(String uri) {
|
||||
return unlinkedSummaries[uri];
|
||||
}
|
||||
|
||||
@override
|
||||
bool hasLibrarySummary(String uri) {
|
||||
return uri.startsWith('dart:');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* An implementation of [DartSdk] which provides analysis results for `dart:`
|
||||
@@ -143,8 +64,10 @@ class SummaryBasedDartSdk implements DartSdk {
|
||||
SourceFactory factory = new SourceFactory(
|
||||
[new DartUriResolver(this)], null, resourceProvider);
|
||||
_analysisContext.sourceFactory = factory;
|
||||
SummaryDataStore dataStore = new SummaryDataStore([]);
|
||||
dataStore.addBundle(null, _bundle);
|
||||
_analysisContext.resultProvider =
|
||||
new SdkSummaryResultProvider(_analysisContext, _bundle, strongMode);
|
||||
new InputPackagesResultProvider(_analysisContext, dataStore);
|
||||
}
|
||||
return _analysisContext;
|
||||
}
|
||||
|
||||
@@ -146,7 +146,7 @@ abstract class AbstractResynthesizeTest extends AbstractSingleUnitTest {
|
||||
TestSummaryResynthesizer resynthesizer, LibraryElement library) {
|
||||
// Check that no other summaries needed to be resynthesized to resynthesize
|
||||
// the library element.
|
||||
expect(resynthesizer.resynthesisCount, 1);
|
||||
expect(resynthesizer.resynthesisCount, 3);
|
||||
// Check that the only linked summary consulted was that for [uri].
|
||||
expect(resynthesizer.linkedSummariesRequested, hasLength(1));
|
||||
expect(resynthesizer.linkedSummariesRequested.first,
|
||||
@@ -4888,7 +4888,7 @@ var x;''');
|
||||
checkMinimalResynthesisWork(resynthesizer, original.library);
|
||||
// Check that no other summaries needed to be resynthesized to resynthesize
|
||||
// the library element.
|
||||
expect(resynthesizer.resynthesisCount, 1);
|
||||
expect(resynthesizer.resynthesisCount, 3);
|
||||
expect(result.location, location);
|
||||
return result;
|
||||
}
|
||||
@@ -4913,8 +4913,12 @@ class TestSummaryResynthesizer extends SummaryResynthesizer {
|
||||
|
||||
TestSummaryResynthesizer(SummaryResynthesizer parent, AnalysisContext context,
|
||||
this.unlinkedSummaries, this.linkedSummaries, this.allowMissingFiles)
|
||||
: super(parent, context, context.typeProvider, context.sourceFactory,
|
||||
context.analysisOptions.strongMode);
|
||||
: super(parent, context, context.sourceFactory,
|
||||
context.analysisOptions.strongMode) {
|
||||
// Clear after resynthesizing TypeProvider in super().
|
||||
unlinkedSummariesRequested.clear();
|
||||
linkedSummariesRequested.clear();
|
||||
}
|
||||
|
||||
@override
|
||||
LinkedLibrary getLinkedSummary(String uri) {
|
||||
|
||||
@@ -32,6 +32,7 @@ import 'package:analyzer/src/generated/utilities_general.dart'
|
||||
import 'package:analyzer/src/lint/registry.dart';
|
||||
import 'package:analyzer/src/services/lint.dart';
|
||||
import 'package:analyzer/src/source/source_resource.dart';
|
||||
import 'package:analyzer/src/summary/idl.dart';
|
||||
import 'package:analyzer/src/summary/package_bundle_reader.dart';
|
||||
import 'package:analyzer/src/summary/summary_sdk.dart' show SummaryBasedDartSdk;
|
||||
import 'package:analyzer/src/task/options.dart';
|
||||
@@ -516,6 +517,11 @@ class Driver implements CommandLineStarter {
|
||||
// Once options and embedders are processed, setup the SDK.
|
||||
_setupSdk(options, useSummaries);
|
||||
|
||||
PackageBundle sdkBundle = sdk.getLinkedBundle();
|
||||
if (sdkBundle != null) {
|
||||
summaryDataStore.addBundle(null, sdkBundle);
|
||||
}
|
||||
|
||||
// Choose a package resolution policy and a diet parsing policy based on
|
||||
// the command-line options.
|
||||
SourceFactory sourceFactory = _chooseUriResolutionPolicy(
|
||||
@@ -530,8 +536,10 @@ class Driver implements CommandLineStarter {
|
||||
});
|
||||
|
||||
_context.sourceFactory = sourceFactory;
|
||||
_context.resultProvider =
|
||||
new InputPackagesResultProvider(_context, summaryDataStore);
|
||||
if (sdkBundle != null) {
|
||||
_context.resultProvider =
|
||||
new InputPackagesResultProvider(_context, summaryDataStore);
|
||||
}
|
||||
}
|
||||
|
||||
/// Return discovered packagespec, or `null` if none is found.
|
||||
|
||||
@@ -86,6 +86,7 @@ class ModuleCompiler {
|
||||
// Read the summaries.
|
||||
var summaryData =
|
||||
new SummaryDataStore(options.summaryPaths, recordDependencyInfo: true);
|
||||
summaryData.addBundle(null, sdk.getLinkedBundle());
|
||||
|
||||
var srcFactory = createSourceFactory(options,
|
||||
sdkResolver: sdkResolver,
|
||||
@@ -97,7 +98,6 @@ class ModuleCompiler {
|
||||
AnalysisEngine.instance.createAnalysisContext() as AnalysisContextImpl;
|
||||
context.analysisOptions = analysisOptions;
|
||||
context.sourceFactory = srcFactory;
|
||||
context.typeProvider = sdkResolver.dartSdk.context.typeProvider;
|
||||
context.resultProvider =
|
||||
new InputPackagesResultProvider(context, summaryData);
|
||||
options.declaredVariables.forEach(context.declaredVariables.define);
|
||||
|
||||
@@ -13,8 +13,8 @@ import 'package:analyzer/src/dart/analysis/file_state.dart';
|
||||
import 'package:analyzer/src/generated/engine.dart';
|
||||
import 'package:analyzer/src/generated/sdk.dart';
|
||||
import 'package:analyzer/src/generated/source.dart';
|
||||
import 'package:analyzer/src/generated/utilities_dart.dart';
|
||||
import 'package:analyzer/src/summary/idl.dart';
|
||||
import 'package:analyzer/src/summary/summary_sdk.dart';
|
||||
import 'package:analyzer/src/util/absolute_path.dart';
|
||||
import 'package:front_end/incremental_resolved_ast_generator.dart';
|
||||
import 'package:front_end/src/base/file_repository.dart';
|
||||
@@ -123,9 +123,6 @@ class IncrementalResolvedAstGeneratorImpl
|
||||
await _options.getSdkSummary(), sdkContext, _fileRepository);
|
||||
sdkContext.sourceFactory =
|
||||
new SourceFactory([new DartUriResolver(dartSdk)]);
|
||||
bool strongMode = true; // TODO(paulberry): support strong mode flag.
|
||||
sdkContext.resultProvider = new SdkSummaryResultProvider(
|
||||
sdkContext, await _options.getSdkSummary(), strongMode);
|
||||
|
||||
var sourceFactory = new _SourceFactoryProxy(dartSdk, _fileRepository);
|
||||
var analysisOptions = new AnalysisOptionsImpl();
|
||||
@@ -270,6 +267,10 @@ class _SourceFactoryProxy implements SourceFactory {
|
||||
@override
|
||||
Source forUri(String absoluteUri) {
|
||||
Uri uri = Uri.parse(absoluteUri);
|
||||
if (uri.scheme == 'dart') {
|
||||
return new _SourceProxy(
|
||||
uri, _fileRepository.pathForUri(uri, allocate: true));
|
||||
}
|
||||
return new _SourceProxy(uri, _fileRepository.pathForUri(uri));
|
||||
}
|
||||
|
||||
@@ -278,9 +279,9 @@ class _SourceFactoryProxy implements SourceFactory {
|
||||
Source resolveUri(Source containingSource, String containedUri) {
|
||||
// TODO(paulberry): re-use code from dependency_grapher_impl, and support
|
||||
// SDK URI resolution logic.
|
||||
var absoluteUri = containingSource == null
|
||||
? containedUri
|
||||
: containingSource.uri.resolve(containedUri).toString();
|
||||
String absoluteUri =
|
||||
resolveRelativeUri(containingSource?.uri, Uri.parse(containedUri))
|
||||
.toString();
|
||||
return forUri(absoluteUri);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user