| 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/element/element.dart'; | 11 import 'package:analyzer/dart/element/element.dart'; |
| 11 import 'package:analyzer/dart/element/type.dart'; | 12 import 'package:analyzer/dart/element/type.dart'; |
| 12 import 'package:analyzer/instrumentation/instrumentation.dart'; | 13 import 'package:analyzer/instrumentation/instrumentation.dart'; |
| 13 import 'package:analyzer/plugin/task.dart'; | 14 import 'package:analyzer/plugin/task.dart'; |
| 14 import 'package:analyzer/source/embedder.dart'; | 15 import 'package:analyzer/source/embedder.dart'; |
| 15 import 'package:analyzer/src/cancelable_future.dart'; | 16 import 'package:analyzer/src/cancelable_future.dart'; |
| 16 import 'package:analyzer/src/context/cache.dart'; | 17 import 'package:analyzer/src/context/cache.dart'; |
| 17 import 'package:analyzer/src/dart/element/element.dart'; | 18 import 'package:analyzer/src/dart/element/element.dart'; |
| 18 import 'package:analyzer/src/dart/element/type.dart'; | 19 import 'package:analyzer/src/dart/element/type.dart'; |
| 19 import 'package:analyzer/src/generated/ast.dart'; | |
| 20 import 'package:analyzer/src/generated/constant.dart'; | 20 import 'package:analyzer/src/generated/constant.dart'; |
| 21 import 'package:analyzer/src/generated/engine.dart'; | 21 import 'package:analyzer/src/generated/engine.dart'; |
| 22 import 'package:analyzer/src/generated/error.dart'; | 22 import 'package:analyzer/src/generated/error.dart'; |
| 23 import 'package:analyzer/src/generated/incremental_resolver.dart'; | 23 import 'package:analyzer/src/generated/incremental_resolver.dart'; |
| 24 import 'package:analyzer/src/generated/java_core.dart'; | 24 import 'package:analyzer/src/generated/java_core.dart'; |
| 25 import 'package:analyzer/src/generated/java_engine.dart'; | 25 import 'package:analyzer/src/generated/java_engine.dart'; |
| 26 import 'package:analyzer/src/generated/resolver.dart'; | 26 import 'package:analyzer/src/generated/resolver.dart'; |
| 27 import 'package:analyzer/src/generated/sdk.dart' show DartSdk; | 27 import 'package:analyzer/src/generated/sdk.dart' show DartSdk; |
| 28 import 'package:analyzer/src/generated/source.dart'; | 28 import 'package:analyzer/src/generated/source.dart'; |
| 29 import 'package:analyzer/src/generated/testing/ast_factory.dart'; | 29 import 'package:analyzer/src/generated/testing/ast_factory.dart'; |
| (...skipping 609 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 639 if (!AnalysisEngine.isDartFileName(unitSource.shortName) || | 639 if (!AnalysisEngine.isDartFileName(unitSource.shortName) || |
| 640 !AnalysisEngine.isDartFileName(librarySource.shortName)) { | 640 !AnalysisEngine.isDartFileName(librarySource.shortName)) { |
| 641 return new CancelableFuture.error(new AnalysisNotScheduledError()); | 641 return new CancelableFuture.error(new AnalysisNotScheduledError()); |
| 642 } | 642 } |
| 643 return new AnalysisFutureHelper<CompilationUnit>(this, | 643 return new AnalysisFutureHelper<CompilationUnit>(this, |
| 644 new LibrarySpecificUnit(librarySource, unitSource), RESOLVED_UNIT) | 644 new LibrarySpecificUnit(librarySource, unitSource), RESOLVED_UNIT) |
| 645 .computeAsync(); | 645 .computeAsync(); |
| 646 } | 646 } |
| 647 | 647 |
| 648 @override | 648 @override |
| 649 Object /*=V*/ computeResult /*<V>*/ ( | 649 Object/*=V*/ computeResult/*<V>*/( |
| 650 AnalysisTarget target, ResultDescriptor /*<V>*/ descriptor) { | 650 AnalysisTarget target, ResultDescriptor/*<V>*/ descriptor) { |
| 651 // Make sure we are not trying to invoke the task model in a reentrant | 651 // Make sure we are not trying to invoke the task model in a reentrant |
| 652 // fashion. | 652 // fashion. |
| 653 assert(!driver.isTaskRunning); | 653 assert(!driver.isTaskRunning); |
| 654 CacheEntry entry = getCacheEntry(target); | 654 CacheEntry entry = getCacheEntry(target); |
| 655 CacheState state = entry.getState(descriptor); | 655 CacheState state = entry.getState(descriptor); |
| 656 if (state == CacheState.FLUSHED || state == CacheState.INVALID) { | 656 if (state == CacheState.FLUSHED || state == CacheState.INVALID) { |
| 657 driver.computeResult(target, descriptor); | 657 driver.computeResult(target, descriptor); |
| 658 } | 658 } |
| 659 state = entry.getState(descriptor); | 659 state = entry.getState(descriptor); |
| 660 if (state == CacheState.ERROR) { | 660 if (state == CacheState.ERROR) { |
| (...skipping 1444 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2105 } | 2105 } |
| 2106 DartSdk sdk = factory.dartSdk; | 2106 DartSdk sdk = factory.dartSdk; |
| 2107 if (sdk == null) { | 2107 if (sdk == null) { |
| 2108 throw new IllegalArgumentException( | 2108 throw new IllegalArgumentException( |
| 2109 "The source factory for an SDK analysis context must have a DartUriRes
olver"); | 2109 "The source factory for an SDK analysis context must have a DartUriRes
olver"); |
| 2110 } | 2110 } |
| 2111 return new AnalysisCache( | 2111 return new AnalysisCache( |
| 2112 <CachePartition>[AnalysisEngine.instance.partitionManager.forSdk(sdk)]); | 2112 <CachePartition>[AnalysisEngine.instance.partitionManager.forSdk(sdk)]); |
| 2113 } | 2113 } |
| 2114 } | 2114 } |
| OLD | NEW |