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

Unified Diff: pkg/analyzer/lib/src/summary/summary_sdk.dart

Issue 2176363002: Removed io dependencies in analyzer to allow compiler to run in the browser (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Refactored summary_sdk Created 4 years, 5 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
Index: pkg/analyzer/lib/src/summary/summary_sdk.dart
diff --git a/pkg/analyzer/lib/src/summary/summary_sdk.dart b/pkg/analyzer/lib/src/summary/summary_sdk.dart
index 987a1878564dcdbaa11e2f899f790b40be170d4a..7003905c67bd26f79040a0d66d6ba7f07bd8f747 100644
--- a/pkg/analyzer/lib/src/summary/summary_sdk.dart
+++ b/pkg/analyzer/lib/src/summary/summary_sdk.dart
@@ -20,6 +20,7 @@ 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;
+import 'package:analyzer/file_system/file_system.dart' show ResourceProvider;
class SdkSummaryResultProvider extends ResynthesizerResultProvider {
final SummaryTypeProvider typeProvider = new SummaryTypeProvider();
@@ -106,14 +107,20 @@ class SummaryBasedDartSdk implements DartSdk {
SummaryDataStore _dataStore;
InSummaryPackageUriResolver _uriResolver;
PackageBundle _bundle;
+ ResourceProvider resourceProvider;
/**
* The [AnalysisContext] which is used for all of the sources in this sdk.
*/
InternalAnalysisContext _analysisContext;
- SummaryBasedDartSdk(String summaryPath, this.strongMode) {
- _dataStore = new SummaryDataStore(<String>[summaryPath]);
+ SummaryBasedDartSdk(String summaryPath, this.strongMode,
Paul Berry 2016/07/26 21:16:22 Rather than have one constructor with two differen
priscillalee 2016/07/26 21:32:48 Done.
+ [PackageBundle bundle, this.resourceProvider]) {
+ if (summaryPath != null) {
+ _dataStore = new SummaryDataStore(<String>[summaryPath]);
+ } else {
+ _dataStore = new SummaryDataStore([], bundle);
+ }
_uriResolver = new InSummaryPackageUriResolver(_dataStore);
_bundle = _dataStore.bundles.single;
}
@@ -129,7 +136,8 @@ class SummaryBasedDartSdk implements DartSdk {
AnalysisOptionsImpl analysisOptions = new AnalysisOptionsImpl()
..strongMode = strongMode;
_analysisContext = new SdkAnalysisContext(analysisOptions);
- SourceFactory factory = new SourceFactory([new DartUriResolver(this)]);
+ SourceFactory factory = new SourceFactory(
+ [new DartUriResolver(this)], null, resourceProvider);
_analysisContext.sourceFactory = factory;
_analysisContext.resultProvider =
new SdkSummaryResultProvider(_analysisContext, _bundle, strongMode);

Powered by Google App Engine
This is Rietveld 408576698