| 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/element/element.dart'; | 10 import 'package:analyzer/dart/element/element.dart'; |
| (...skipping 468 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 479 @override | 479 @override |
| 480 TypeSystem get typeSystem { | 480 TypeSystem get typeSystem { |
| 481 if (_typeSystem == null) { | 481 if (_typeSystem == null) { |
| 482 _typeSystem = TypeSystem.create(this); | 482 _typeSystem = TypeSystem.create(this); |
| 483 } | 483 } |
| 484 return _typeSystem; | 484 return _typeSystem; |
| 485 } | 485 } |
| 486 | 486 |
| 487 @override | 487 @override |
| 488 bool aboutToComputeResult(CacheEntry entry, ResultDescriptor result) { | 488 bool aboutToComputeResult(CacheEntry entry, ResultDescriptor result) { |
| 489 AnalysisTarget target = entry.target; |
| 490 // TYPE_PROVIDER |
| 491 if (target is AnalysisContextTarget && result == TYPE_PROVIDER) { |
| 492 DartSdk dartSdk = sourceFactory.dartSdk; |
| 493 if (dartSdk != null) { |
| 494 AnalysisContext sdkContext = dartSdk.context; |
| 495 if (!identical(sdkContext, this) && |
| 496 sdkContext is InternalAnalysisContext) { |
| 497 return sdkContext.aboutToComputeResult(entry, result); |
| 498 } |
| 499 } |
| 500 } |
| 501 // A result for a Source. |
| 502 Source source = target.source; |
| 503 if (source != null) { |
| 504 InternalAnalysisContext context = _cache.getContextFor(source); |
| 505 if (!identical(context, this)) { |
| 506 return context.aboutToComputeResult(entry, result); |
| 507 } |
| 508 } |
| 489 return false; | 509 return false; |
| 490 } | 510 } |
| 491 | 511 |
| 492 @override | 512 @override |
| 493 void addListener(AnalysisListener listener) { | 513 void addListener(AnalysisListener listener) { |
| 494 if (!_listeners.contains(listener)) { | 514 if (!_listeners.contains(listener)) { |
| 495 _listeners.add(listener); | 515 _listeners.add(listener); |
| 496 } | 516 } |
| 497 } | 517 } |
| 498 | 518 |
| (...skipping 1510 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2009 } | 2029 } |
| 2010 DartSdk sdk = factory.dartSdk; | 2030 DartSdk sdk = factory.dartSdk; |
| 2011 if (sdk == null) { | 2031 if (sdk == null) { |
| 2012 throw new IllegalArgumentException( | 2032 throw new IllegalArgumentException( |
| 2013 "The source factory for an SDK analysis context must have a DartUriRes
olver"); | 2033 "The source factory for an SDK analysis context must have a DartUriRes
olver"); |
| 2014 } | 2034 } |
| 2015 return new AnalysisCache( | 2035 return new AnalysisCache( |
| 2016 <CachePartition>[AnalysisEngine.instance.partitionManager.forSdk(sdk)]); | 2036 <CachePartition>[AnalysisEngine.instance.partitionManager.forSdk(sdk)]); |
| 2017 } | 2037 } |
| 2018 } | 2038 } |
| OLD | NEW |