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 656 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
667 bool exists(Source source) { | 667 bool exists(Source source) { |
668 if (source == null) { | 668 if (source == null) { |
669 return false; | 669 return false; |
670 } | 670 } |
671 if (_contentCache.getContents(source) != null) { | 671 if (_contentCache.getContents(source) != null) { |
672 return true; | 672 return true; |
673 } | 673 } |
674 return source.exists(); | 674 return source.exists(); |
675 } | 675 } |
676 | 676 |
677 Element findElementById(int id) { | |
678 // TODO(brianwilkerson) Implement this. | |
679 return null; | |
680 // _ElementByIdFinder finder = new _ElementByIdFinder(id); | |
681 // try { | |
682 // MapIterator<AnalysisTarget, cache.CacheEntry> iterator = | |
683 // _cache.iterator(); | |
684 // while (iterator.moveNext()) { | |
685 // cache.CacheEntry entry = iterator.value; | |
686 // if (entry.getValue(SOURCE_KIND) == SourceKind.LIBRARY) { | |
687 // DartEntry dartEntry = entry; | |
688 // LibraryElement library = dartEntry.getValue(DartEntry.ELEMENT); | |
689 // if (library != null) { | |
690 // library.accept(finder); | |
691 // } | |
692 // } | |
693 // } | |
694 // } on _ElementByIdFinderException { | |
695 // return finder.result; | |
696 // } | |
697 // return null; | |
698 } | |
699 | |
700 @override | 677 @override |
701 cache.CacheEntry getCacheEntry(AnalysisTarget target) { | 678 cache.CacheEntry getCacheEntry(AnalysisTarget target) { |
702 cache.CacheEntry entry = _cache.get(target); | 679 cache.CacheEntry entry = _cache.get(target); |
703 if (entry == null) { | 680 if (entry == null) { |
704 entry = new cache.CacheEntry(); | 681 entry = new cache.CacheEntry(); |
705 _cache.put(target, entry); | 682 _cache.put(target, entry); |
706 } | 683 } |
707 return entry; | 684 return entry; |
708 } | 685 } |
709 | 686 |
(...skipping 1412 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2122 PendingFuture pendingFuture = | 2099 PendingFuture pendingFuture = |
2123 new PendingFuture<T>(_context, target, computeValue); | 2100 new PendingFuture<T>(_context, target, computeValue); |
2124 if (!pendingFuture.evaluate(entry)) { | 2101 if (!pendingFuture.evaluate(entry)) { |
2125 _context._pendingFutureTargets | 2102 _context._pendingFutureTargets |
2126 .putIfAbsent(target, () => <PendingFuture>[]) | 2103 .putIfAbsent(target, () => <PendingFuture>[]) |
2127 .add(pendingFuture); | 2104 .add(pendingFuture); |
2128 } | 2105 } |
2129 return pendingFuture.future; | 2106 return pendingFuture.future; |
2130 } | 2107 } |
2131 } | 2108 } |
OLD | NEW |