| 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/src/cancelable_future.dart'; | 10 import 'package:analyzer/src/cancelable_future.dart'; |
| (...skipping 683 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 694 // } on _ElementByIdFinderException { | 694 // } on _ElementByIdFinderException { |
| 695 // return finder.result; | 695 // return finder.result; |
| 696 // } | 696 // } |
| 697 // return null; | 697 // return null; |
| 698 } | 698 } |
| 699 | 699 |
| 700 @override | 700 @override |
| 701 cache.CacheEntry getCacheEntry(AnalysisTarget target) { | 701 cache.CacheEntry getCacheEntry(AnalysisTarget target) { |
| 702 cache.CacheEntry entry = _cache.get(target); | 702 cache.CacheEntry entry = _cache.get(target); |
| 703 if (entry == null) { | 703 if (entry == null) { |
| 704 entry = new cache.CacheEntry(); | 704 entry = new cache.CacheEntry(target); |
| 705 _cache.put(target, entry); | 705 _cache.put(entry); |
| 706 } | 706 } |
| 707 return entry; | 707 return entry; |
| 708 } | 708 } |
| 709 | 709 |
| 710 @override | 710 @override |
| 711 CompilationUnitElement getCompilationUnitElement( | 711 CompilationUnitElement getCompilationUnitElement( |
| 712 Source unitSource, Source librarySource) { | 712 Source unitSource, Source librarySource) { |
| 713 AnalysisTarget target = new LibrarySpecificUnit(librarySource, unitSource); | 713 AnalysisTarget target = new LibrarySpecificUnit(librarySource, unitSource); |
| 714 return _getResult(target, COMPILATION_UNIT_ELEMENT); | 714 return _getResult(target, COMPILATION_UNIT_ELEMENT); |
| 715 } | 715 } |
| (...skipping 707 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1423 String originalContents = _contentCache.setContents(source, contents); | 1423 String originalContents = _contentCache.setContents(source, contents); |
| 1424 handleContentsChanged(source, originalContents, contents, notify); | 1424 handleContentsChanged(source, originalContents, contents, notify); |
| 1425 } | 1425 } |
| 1426 | 1426 |
| 1427 /** | 1427 /** |
| 1428 * Create a cache entry for the given [source]. The source was explicitly | 1428 * Create a cache entry for the given [source]. The source was explicitly |
| 1429 * added to this context if [explicitlyAdded] is `true`. Return the cache | 1429 * added to this context if [explicitlyAdded] is `true`. Return the cache |
| 1430 * entry that was created. | 1430 * entry that was created. |
| 1431 */ | 1431 */ |
| 1432 cache.CacheEntry _createCacheEntry(Source source, bool explicitlyAdded) { | 1432 cache.CacheEntry _createCacheEntry(Source source, bool explicitlyAdded) { |
| 1433 cache.CacheEntry entry = new cache.CacheEntry(); | 1433 cache.CacheEntry entry = new cache.CacheEntry(source); |
| 1434 entry.modificationTime = getModificationStamp(source); | 1434 entry.modificationTime = getModificationStamp(source); |
| 1435 entry.explicitlyAdded = explicitlyAdded; | 1435 entry.explicitlyAdded = explicitlyAdded; |
| 1436 _cache.put(source, entry); | 1436 _cache.put(entry); |
| 1437 return entry; | 1437 return entry; |
| 1438 } | 1438 } |
| 1439 | 1439 |
| 1440 /** | 1440 /** |
| 1441 * Return a list containing all of the change notices that are waiting to be | 1441 * Return a list containing all of the change notices that are waiting to be |
| 1442 * returned. If there are no notices, then return either `null` or an empty | 1442 * returned. If there are no notices, then return either `null` or an empty |
| 1443 * list, depending on the value of [nullIfEmpty]. | 1443 * list, depending on the value of [nullIfEmpty]. |
| 1444 */ | 1444 */ |
| 1445 List<ChangeNotice> _getChangeNotices(bool nullIfEmpty) { | 1445 List<ChangeNotice> _getChangeNotices(bool nullIfEmpty) { |
| 1446 if (_pendingNotices.isEmpty) { | 1446 if (_pendingNotices.isEmpty) { |
| (...skipping 675 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2122 PendingFuture pendingFuture = | 2122 PendingFuture pendingFuture = |
| 2123 new PendingFuture<T>(_context, target, computeValue); | 2123 new PendingFuture<T>(_context, target, computeValue); |
| 2124 if (!pendingFuture.evaluate(entry)) { | 2124 if (!pendingFuture.evaluate(entry)) { |
| 2125 _context._pendingFutureTargets | 2125 _context._pendingFutureTargets |
| 2126 .putIfAbsent(target, () => <PendingFuture>[]) | 2126 .putIfAbsent(target, () => <PendingFuture>[]) |
| 2127 .add(pendingFuture); | 2127 .add(pendingFuture); |
| 2128 } | 2128 } |
| 2129 return pendingFuture.future; | 2129 return pendingFuture.future; |
| 2130 } | 2130 } |
| 2131 } | 2131 } |
| OLD | NEW |