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 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
71 * The next context identifier. | 71 * The next context identifier. |
72 */ | 72 */ |
73 static int _NEXT_ID = 0; | 73 static int _NEXT_ID = 0; |
74 | 74 |
75 /** | 75 /** |
76 * The unique identifier of this context. | 76 * The unique identifier of this context. |
77 */ | 77 */ |
78 final int _id = _NEXT_ID++; | 78 final int _id = _NEXT_ID++; |
79 | 79 |
80 /** | 80 /** |
| 81 * The flag that is `true` if the context is being analyzed. |
| 82 */ |
| 83 bool _isActive = false; |
| 84 |
| 85 /** |
81 * A client-provided name used to identify this context, or `null` if the | 86 * A client-provided name used to identify this context, or `null` if the |
82 * client has not provided a name. | 87 * client has not provided a name. |
83 */ | 88 */ |
84 @override | 89 @override |
85 String name; | 90 String name; |
86 | 91 |
87 /** | 92 /** |
88 * The set of analysis options controlling the behavior of this context. | 93 * The set of analysis options controlling the behavior of this context. |
89 */ | 94 */ |
90 AnalysisOptionsImpl _options = new AnalysisOptionsImpl(); | 95 AnalysisOptionsImpl _options = new AnalysisOptionsImpl(); |
(...skipping 299 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
390 } | 395 } |
391 | 396 |
392 @override | 397 @override |
393 List<Source> get htmlSources => _getSources(SourceKind.HTML); | 398 List<Source> get htmlSources => _getSources(SourceKind.HTML); |
394 | 399 |
395 @override | 400 @override |
396 Stream<ImplicitAnalysisEvent> get implicitAnalysisEvents => | 401 Stream<ImplicitAnalysisEvent> get implicitAnalysisEvents => |
397 _implicitAnalysisEventsController.stream; | 402 _implicitAnalysisEventsController.stream; |
398 | 403 |
399 @override | 404 @override |
| 405 bool get isActive => _isActive; |
| 406 |
| 407 @override |
| 408 set isActive(bool active) { |
| 409 if (active != _isActive) { |
| 410 _isActive = active; |
| 411 _privatePartition.isActive = active; |
| 412 } |
| 413 } |
| 414 |
| 415 @override |
400 bool get isDisposed => _disposed; | 416 bool get isDisposed => _disposed; |
401 | 417 |
402 @override | 418 @override |
403 List<Source> get launchableClientLibrarySources { | 419 List<Source> get launchableClientLibrarySources { |
404 List<Source> sources = <Source>[]; | 420 List<Source> sources = <Source>[]; |
405 for (Source source in _cache.sources) { | 421 for (Source source in _cache.sources) { |
406 CacheEntry entry = _cache.get(source); | 422 CacheEntry entry = _cache.get(source); |
407 if (entry.getValue(SOURCE_KIND) == SourceKind.LIBRARY && | 423 if (entry.getValue(SOURCE_KIND) == SourceKind.LIBRARY && |
408 !source.isInSystemLibrary && | 424 !source.isInSystemLibrary && |
409 isClientLibrary(source)) { | 425 isClientLibrary(source)) { |
(...skipping 1888 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2298 } | 2314 } |
2299 DartSdk sdk = factory.dartSdk; | 2315 DartSdk sdk = factory.dartSdk; |
2300 if (sdk == null) { | 2316 if (sdk == null) { |
2301 throw new IllegalArgumentException( | 2317 throw new IllegalArgumentException( |
2302 "The source factory for an SDK analysis context must have a DartUriRes
olver"); | 2318 "The source factory for an SDK analysis context must have a DartUriRes
olver"); |
2303 } | 2319 } |
2304 return new AnalysisCache( | 2320 return new AnalysisCache( |
2305 <CachePartition>[AnalysisEngine.instance.partitionManager.forSdk(sdk)]); | 2321 <CachePartition>[AnalysisEngine.instance.partitionManager.forSdk(sdk)]); |
2306 } | 2322 } |
2307 } | 2323 } |
OLD | NEW |