OLD | NEW |
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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 // This code was auto-generated, is not intended to be edited, and is subject to | 5 // This code was auto-generated, is not intended to be edited, and is subject to |
6 // significant change. Please see the README file for more information. | 6 // significant change. Please see the README file for more information. |
7 | 7 |
8 library engine; | 8 library engine; |
9 | 9 |
10 import "dart:math" as math; | 10 import "dart:math" as math; |
(...skipping 1778 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1789 bool exists(Source source) { | 1789 bool exists(Source source) { |
1790 if (source == null) { | 1790 if (source == null) { |
1791 return false; | 1791 return false; |
1792 } | 1792 } |
1793 if (_contentCache.getContents(source) != null) { | 1793 if (_contentCache.getContents(source) != null) { |
1794 return true; | 1794 return true; |
1795 } | 1795 } |
1796 return source.exists(); | 1796 return source.exists(); |
1797 } | 1797 } |
1798 | 1798 |
1799 Element findElementById(int id) { | |
1800 _ElementByIdFinder finder = new _ElementByIdFinder(id); | |
1801 try { | |
1802 MapIterator<Source, SourceEntry> iterator = _cache.iterator(); | |
1803 while (iterator.moveNext()) { | |
1804 SourceEntry sourceEntry = iterator.value; | |
1805 if (sourceEntry.kind == SourceKind.LIBRARY) { | |
1806 DartEntry dartEntry = sourceEntry; | |
1807 LibraryElement library = dartEntry.getValue(DartEntry.ELEMENT); | |
1808 if (library != null) { | |
1809 library.accept(finder); | |
1810 } | |
1811 } | |
1812 } | |
1813 } on _ElementByIdFinderException { | |
1814 return finder.result; | |
1815 } | |
1816 return null; | |
1817 } | |
1818 | |
1819 @override | 1799 @override |
1820 cache.CacheEntry getCacheEntry(AnalysisTarget target) { | 1800 cache.CacheEntry getCacheEntry(AnalysisTarget target) { |
1821 return null; | 1801 return null; |
1822 } | 1802 } |
1823 | 1803 |
1824 @override | 1804 @override |
1825 CompilationUnitElement getCompilationUnitElement( | 1805 CompilationUnitElement getCompilationUnitElement( |
1826 Source unitSource, Source librarySource) { | 1806 Source unitSource, Source librarySource) { |
1827 LibraryElement libraryElement = getLibraryElement(librarySource); | 1807 LibraryElement libraryElement = getLibraryElement(librarySource); |
1828 if (libraryElement != null) { | 1808 if (libraryElement != null) { |
(...skipping 9851 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
11680 PendingFuture pendingFuture = | 11660 PendingFuture pendingFuture = |
11681 new PendingFuture<T>(_context, source, computeValue); | 11661 new PendingFuture<T>(_context, source, computeValue); |
11682 if (!pendingFuture.evaluate(sourceEntry)) { | 11662 if (!pendingFuture.evaluate(sourceEntry)) { |
11683 _context._pendingFutureSources | 11663 _context._pendingFutureSources |
11684 .putIfAbsent(source, () => <PendingFuture>[]) | 11664 .putIfAbsent(source, () => <PendingFuture>[]) |
11685 .add(pendingFuture); | 11665 .add(pendingFuture); |
11686 } | 11666 } |
11687 return pendingFuture.future; | 11667 return pendingFuture.future; |
11688 } | 11668 } |
11689 } | 11669 } |
11690 | |
11691 class _ElementByIdFinder extends GeneralizingElementVisitor { | |
11692 final int _id; | |
11693 Element result; | |
11694 | |
11695 _ElementByIdFinder(this._id); | |
11696 | |
11697 @override | |
11698 visitElement(Element element) { | |
11699 if (element.id == _id) { | |
11700 result = element; | |
11701 throw new _ElementByIdFinderException(); | |
11702 } | |
11703 super.visitElement(element); | |
11704 } | |
11705 } | |
11706 | |
11707 class _ElementByIdFinderException {} | |
OLD | NEW |