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 448 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
459 target, iterator.value, false, hintsEnabled, lintsEnabled, sources); | 459 target, iterator.value, false, hintsEnabled, lintsEnabled, sources); |
460 } | 460 } |
461 } | 461 } |
462 return new List<Source>.from(sources); | 462 return new List<Source>.from(sources); |
463 } | 463 } |
464 | 464 |
465 List<Source> get test_priorityOrder => _priorityOrder; | 465 List<Source> get test_priorityOrder => _priorityOrder; |
466 | 466 |
467 @override | 467 @override |
468 TypeProvider get typeProvider { | 468 TypeProvider get typeProvider { |
469 // The `AnalysisContextTarget.request` results to into the SDK partition, | |
Paul Berry
2016/06/02 12:09:35
"to" -> "go"
| |
470 // and the TYPE_PROVIDER result is computed and put into the SDK partition | |
471 // only by the first non-SDK analysis context. So, in order to reuse it | |
472 // in other analysis context, we need to ask it from the cache. | |
Paul Berry
2016/06/02 12:09:36
"in other analysis context, we need to ask it" ->
| |
473 _typeProvider ??= getResult(AnalysisContextTarget.request, TYPE_PROVIDER); | |
469 if (_typeProvider != null) { | 474 if (_typeProvider != null) { |
470 return _typeProvider; | 475 return _typeProvider; |
471 } | 476 } |
472 | 477 |
473 // Make sure a task didn't accidentally try to call back into the context | 478 // Make sure a task didn't accidentally try to call back into the context |
474 // to retrieve the type provider. | 479 // to retrieve the type provider. |
475 assert(!driver.isTaskRunning); | 480 assert(!driver.isTaskRunning); |
476 | 481 |
477 Source coreSource = sourceFactory.forUri(DartSdk.DART_CORE); | 482 Source coreSource = sourceFactory.forUri(DartSdk.DART_CORE); |
478 if (coreSource == null) { | 483 if (coreSource == null) { |
(...skipping 1735 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2214 } | 2219 } |
2215 DartSdk sdk = factory.dartSdk; | 2220 DartSdk sdk = factory.dartSdk; |
2216 if (sdk == null) { | 2221 if (sdk == null) { |
2217 throw new IllegalArgumentException( | 2222 throw new IllegalArgumentException( |
2218 "The source factory for an SDK analysis context must have a DartUriRes olver"); | 2223 "The source factory for an SDK analysis context must have a DartUriRes olver"); |
2219 } | 2224 } |
2220 return new AnalysisCache( | 2225 return new AnalysisCache( |
2221 <CachePartition>[AnalysisEngine.instance.partitionManager.forSdk(sdk)]); | 2226 <CachePartition>[AnalysisEngine.instance.partitionManager.forSdk(sdk)]); |
2222 } | 2227 } |
2223 } | 2228 } |
OLD | NEW |