| 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 789 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 800 } | 800 } |
| 801 return SourceKind.UNKNOWN; | 801 return SourceKind.UNKNOWN; |
| 802 } | 802 } |
| 803 | 803 |
| 804 @override | 804 @override |
| 805 List<Source> getLibrariesContaining(Source source) { | 805 List<Source> getLibrariesContaining(Source source) { |
| 806 SourceKind kind = getKindOf(source); | 806 SourceKind kind = getKindOf(source); |
| 807 if (kind == SourceKind.LIBRARY) { | 807 if (kind == SourceKind.LIBRARY) { |
| 808 return <Source>[source]; | 808 return <Source>[source]; |
| 809 } else if (kind == SourceKind.PART) { | 809 } else if (kind == SourceKind.PART) { |
| 810 List<Source> libraries = <Source>[]; | 810 return dartWorkManager.getLibrariesContainingPart(source); |
| 811 for (Source library in _cache.sources) { | |
| 812 CacheEntry entry = _cache.get(library); | |
| 813 if (entry.getValue(SOURCE_KIND) == SourceKind.LIBRARY) { | |
| 814 List<Source> parts = entry.getValue(INCLUDED_PARTS); | |
| 815 if (parts.contains(source)) { | |
| 816 libraries.add(library); | |
| 817 } | |
| 818 } | |
| 819 } | |
| 820 if (libraries.isNotEmpty) { | |
| 821 return libraries; | |
| 822 } | |
| 823 } | 811 } |
| 824 return Source.EMPTY_ARRAY; | 812 return Source.EMPTY_ARRAY; |
| 825 } | 813 } |
| 826 | 814 |
| 827 @override | 815 @override |
| 828 List<Source> getLibrariesDependingOn(Source librarySource) { | 816 List<Source> getLibrariesDependingOn(Source librarySource) { |
| 829 List<Source> dependentLibraries = <Source>[]; | 817 List<Source> dependentLibraries = <Source>[]; |
| 830 for (Source source in _cache.sources) { | 818 for (Source source in _cache.sources) { |
| 831 CacheEntry entry = _cache.get(source); | 819 CacheEntry entry = _cache.get(source); |
| 832 if (entry.getValue(SOURCE_KIND) == SourceKind.LIBRARY) { | 820 if (entry.getValue(SOURCE_KIND) == SourceKind.LIBRARY) { |
| (...skipping 1173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2006 PendingFuture pendingFuture = | 1994 PendingFuture pendingFuture = |
| 2007 new PendingFuture<T>(_context, target, computeValue); | 1995 new PendingFuture<T>(_context, target, computeValue); |
| 2008 if (!pendingFuture.evaluate(entry)) { | 1996 if (!pendingFuture.evaluate(entry)) { |
| 2009 _context._pendingFutureTargets | 1997 _context._pendingFutureTargets |
| 2010 .putIfAbsent(target, () => <PendingFuture>[]) | 1998 .putIfAbsent(target, () => <PendingFuture>[]) |
| 2011 .add(pendingFuture); | 1999 .add(pendingFuture); |
| 2012 } | 2000 } |
| 2013 return pendingFuture.future; | 2001 return pendingFuture.future; |
| 2014 } | 2002 } |
| 2015 } | 2003 } |
| OLD | NEW |