OLD | NEW |
1 import 'dart:io' as io; | 1 import 'dart:io' as io; |
2 | 2 |
3 import 'package:analyzer/dart/element/element.dart'; | 3 import 'package:analyzer/dart/element/element.dart'; |
4 import 'package:analyzer/src/context/cache.dart'; | 4 import 'package:analyzer/src/context/cache.dart'; |
5 import 'package:analyzer/src/context/context.dart'; | 5 import 'package:analyzer/src/context/context.dart'; |
6 import 'package:analyzer/src/dart/element/element.dart'; | 6 import 'package:analyzer/src/dart/element/element.dart'; |
7 import 'package:analyzer/src/generated/engine.dart'; | 7 import 'package:analyzer/src/generated/engine.dart'; |
8 import 'package:analyzer/src/generated/java_io.dart'; | 8 import 'package:analyzer/src/generated/java_io.dart'; |
9 import 'package:analyzer/src/generated/resolver.dart'; | 9 import 'package:analyzer/src/generated/resolver.dart'; |
10 import 'package:analyzer/src/generated/source.dart'; | 10 import 'package:analyzer/src/generated/source.dart'; |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
110 bool exists() => true; | 110 bool exists() => true; |
111 | 111 |
112 @override | 112 @override |
113 String toString() => uri.toString(); | 113 String toString() => uri.toString(); |
114 } | 114 } |
115 | 115 |
116 /** | 116 /** |
117 * The [ResultProvider] that provides results using summary resynthesizer. | 117 * The [ResultProvider] that provides results using summary resynthesizer. |
118 */ | 118 */ |
119 abstract class ResynthesizerResultProvider extends ResultProvider { | 119 abstract class ResynthesizerResultProvider extends ResultProvider { |
120 final InternalAnalysisContext _context; | 120 final InternalAnalysisContext context; |
121 final SummaryDataStore _dataStore; | 121 final SummaryDataStore _dataStore; |
122 | 122 |
123 _FileBasedSummaryResynthesizer _resynthesizer; | 123 _FileBasedSummaryResynthesizer _resynthesizer; |
124 ResynthesizerResultProvider _sdkProvider; | 124 ResynthesizerResultProvider _sdkProvider; |
125 | 125 |
126 ResynthesizerResultProvider(this._context, this._dataStore); | 126 ResynthesizerResultProvider(this.context, this._dataStore); |
127 | 127 |
128 SummaryResynthesizer get resynthesizer => _resynthesizer; | 128 SummaryResynthesizer get resynthesizer => _resynthesizer; |
129 | 129 |
130 /** | 130 /** |
131 * Add a new [bundle] to the resynthesizer. | 131 * Add a new [bundle] to the resynthesizer. |
132 */ | 132 */ |
133 void addBundle(String path, PackageBundle bundle) { | 133 void addBundle(String path, PackageBundle bundle) { |
134 _dataStore.addBundle(path, bundle); | 134 _dataStore.addBundle(path, bundle); |
135 } | 135 } |
136 | 136 |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
227 } | 227 } |
228 | 228 |
229 /** | 229 /** |
230 * Create the [resynthesizer] instance. | 230 * Create the [resynthesizer] instance. |
231 * | 231 * |
232 * Subclasses must call this method in their constructors. | 232 * Subclasses must call this method in their constructors. |
233 */ | 233 */ |
234 void createResynthesizer( | 234 void createResynthesizer( |
235 InternalAnalysisContext sdkContext, TypeProvider typeProvider) { | 235 InternalAnalysisContext sdkContext, TypeProvider typeProvider) { |
236 // Set the type provider to prevent the context from computing it. | 236 // Set the type provider to prevent the context from computing it. |
237 _context.typeProvider = typeProvider; | 237 context.typeProvider = typeProvider; |
238 // Create a chained resynthesizer. | 238 // Create a chained resynthesizer. |
239 _sdkProvider = sdkContext?.resultProvider; | 239 _sdkProvider = sdkContext?.resultProvider; |
240 _resynthesizer = new _FileBasedSummaryResynthesizer( | 240 _resynthesizer = new _FileBasedSummaryResynthesizer( |
241 _sdkProvider?.resynthesizer, | 241 _sdkProvider?.resynthesizer, |
242 _context, | 242 context, |
243 typeProvider, | 243 typeProvider, |
244 _context.sourceFactory, | 244 context.sourceFactory, |
245 _context.analysisOptions.strongMode, | 245 context.analysisOptions.strongMode, |
246 _dataStore); | 246 _dataStore); |
247 } | 247 } |
248 | 248 |
249 /** | 249 /** |
250 * Return `true` if this result provider can provide a result for the | 250 * Return `true` if this result provider can provide a result for the |
251 * given [source]. The provider must ensure that [addBundle] is invoked for | 251 * given [source]. The provider must ensure that [addBundle] is invoked for |
252 * every bundle that would be required to provide results for the [source]. | 252 * every bundle that would be required to provide results for the [source]. |
253 */ | 253 */ |
254 bool hasResultsForSource(Source source); | 254 bool hasResultsForSource(Source source); |
255 } | 255 } |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
347 * also provides [summaryPath]. | 347 * also provides [summaryPath]. |
348 */ | 348 */ |
349 class _InSummaryFallbackSource extends FileBasedSource | 349 class _InSummaryFallbackSource extends FileBasedSource |
350 implements InSummarySource { | 350 implements InSummarySource { |
351 @override | 351 @override |
352 final String summaryPath; | 352 final String summaryPath; |
353 | 353 |
354 _InSummaryFallbackSource(JavaFile file, Uri uri, this.summaryPath) | 354 _InSummaryFallbackSource(JavaFile file, Uri uri, this.summaryPath) |
355 : super(file, uri); | 355 : super(file, uri); |
356 } | 356 } |
OLD | NEW |