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/dart/ast/ast.dart'; | 10 import 'package:analyzer/dart/ast/ast.dart'; |
(...skipping 702 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
713 | 713 |
714 @override | 714 @override |
715 Object/*=V*/ computeResult/*<V>*/( | 715 Object/*=V*/ computeResult/*<V>*/( |
716 AnalysisTarget target, ResultDescriptor/*<V>*/ descriptor) { | 716 AnalysisTarget target, ResultDescriptor/*<V>*/ descriptor) { |
717 // Make sure we are not trying to invoke the task model in a reentrant | 717 // Make sure we are not trying to invoke the task model in a reentrant |
718 // fashion. | 718 // fashion. |
719 assert(!driver.isTaskRunning); | 719 assert(!driver.isTaskRunning); |
720 CacheEntry entry = getCacheEntry(target); | 720 CacheEntry entry = getCacheEntry(target); |
721 CacheState state = entry.getState(descriptor); | 721 CacheState state = entry.getState(descriptor); |
722 if (state == CacheState.FLUSHED || state == CacheState.INVALID) { | 722 if (state == CacheState.FLUSHED || state == CacheState.INVALID) { |
| 723 // Check the result provider. |
| 724 bool success = aboutToComputeResult(entry, descriptor); |
| 725 if (success) { |
| 726 return entry.getValue(descriptor); |
| 727 } |
| 728 // Compute the result. |
723 driver.computeResult(target, descriptor); | 729 driver.computeResult(target, descriptor); |
724 entry = getCacheEntry(target); | 730 entry = getCacheEntry(target); |
725 } | 731 } |
726 state = entry.getState(descriptor); | 732 state = entry.getState(descriptor); |
727 if (state == CacheState.ERROR) { | 733 if (state == CacheState.ERROR) { |
728 throw new AnalysisException( | 734 throw new AnalysisException( |
729 'Cannot compute $descriptor for $target', entry.exception); | 735 'Cannot compute $descriptor for $target', entry.exception); |
730 } | 736 } |
731 return entry.getValue(descriptor); | 737 return entry.getValue(descriptor); |
732 } | 738 } |
(...skipping 1496 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2229 } | 2235 } |
2230 DartSdk sdk = factory.dartSdk; | 2236 DartSdk sdk = factory.dartSdk; |
2231 if (sdk == null) { | 2237 if (sdk == null) { |
2232 throw new ArgumentError( | 2238 throw new ArgumentError( |
2233 "The source factory for an SDK analysis context must have a DartUriRes
olver"); | 2239 "The source factory for an SDK analysis context must have a DartUriRes
olver"); |
2234 } | 2240 } |
2235 return new AnalysisCache( | 2241 return new AnalysisCache( |
2236 <CachePartition>[AnalysisEngine.instance.partitionManager.forSdk(sdk)]); | 2242 <CachePartition>[AnalysisEngine.instance.partitionManager.forSdk(sdk)]); |
2237 } | 2243 } |
2238 } | 2244 } |
OLD | NEW |