| OLD | NEW |
| 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 library analyzer.src.context.context; | 5 library analyzer.src.context.context; |
| 6 | 6 |
| 7 import 'dart:async'; | 7 import 'dart:async'; |
| 8 import 'dart:collection'; | 8 import 'dart:collection'; |
| 9 | 9 |
| 10 import 'package:analyzer/instrumentation/instrumentation.dart'; | 10 import 'package:analyzer/instrumentation/instrumentation.dart'; |
| (...skipping 397 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 408 _sourceFactory.context = null; | 408 _sourceFactory.context = null; |
| 409 } | 409 } |
| 410 factory.context = this; | 410 factory.context = this; |
| 411 _sourceFactory = factory; | 411 _sourceFactory = factory; |
| 412 _cache = createCacheFromSourceFactory(factory); | 412 _cache = createCacheFromSourceFactory(factory); |
| 413 for (WorkManager workManager in workManagers) { | 413 for (WorkManager workManager in workManagers) { |
| 414 workManager.onSourceFactoryChanged(); | 414 workManager.onSourceFactoryChanged(); |
| 415 } | 415 } |
| 416 } | 416 } |
| 417 | 417 |
| 418 /** |
| 419 * Invalidate analysis cache. |
| 420 */ |
| 421 void invalidateCachedResults() { |
| 422 _cache = createCacheFromSourceFactory(_sourceFactory); |
| 423 } |
| 424 |
| 418 @override | 425 @override |
| 419 List<Source> get sources { | 426 List<Source> get sources { |
| 420 return _cache.sources.toList(); | 427 return _cache.sources.toList(); |
| 421 } | 428 } |
| 422 | 429 |
| 423 /** | 430 /** |
| 424 * Return a list of the sources that would be processed by | 431 * Return a list of the sources that would be processed by |
| 425 * [performAnalysisTask]. This method duplicates, and must therefore be kept | 432 * [performAnalysisTask]. This method duplicates, and must therefore be kept |
| 426 * in sync with, [getNextAnalysisTask]. This method is intended to be used for | 433 * in sync with, [getNextAnalysisTask]. This method is intended to be used for |
| 427 * testing purposes only. | 434 * testing purposes only. |
| (...skipping 1675 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2103 new PendingFuture<T>(_context, target, computeValue); | 2110 new PendingFuture<T>(_context, target, computeValue); |
| 2104 if (!pendingFuture.evaluate(entry)) { | 2111 if (!pendingFuture.evaluate(entry)) { |
| 2105 _context._pendingFutureTargets | 2112 _context._pendingFutureTargets |
| 2106 .putIfAbsent(target, () => <PendingFuture>[]) | 2113 .putIfAbsent(target, () => <PendingFuture>[]) |
| 2107 .add(pendingFuture); | 2114 .add(pendingFuture); |
| 2108 scheduleComputation(); | 2115 scheduleComputation(); |
| 2109 } | 2116 } |
| 2110 return pendingFuture.future; | 2117 return pendingFuture.future; |
| 2111 } | 2118 } |
| 2112 } | 2119 } |
| OLD | NEW |