Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(285)

Side by Side Diff: pkg/analyzer/lib/src/generated/engine.dart

Issue 958373003: Don't remove indexing operations on potential source changes. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 1835 matching lines...) Expand 10 before | Expand all | Expand 10 after
1846 _disposed = true; 1846 _disposed = true;
1847 for (List<PendingFuture> pendingFutures in _pendingFutureSources.values) { 1847 for (List<PendingFuture> pendingFutures in _pendingFutureSources.values) {
1848 for (PendingFuture pendingFuture in pendingFutures) { 1848 for (PendingFuture pendingFuture in pendingFutures) {
1849 pendingFuture.forciblyComplete(); 1849 pendingFuture.forciblyComplete();
1850 } 1850 }
1851 } 1851 }
1852 _pendingFutureSources.clear(); 1852 _pendingFutureSources.clear();
1853 } 1853 }
1854 1854
1855 @override 1855 @override
1856 CompilationUnit ensureAnyResolvedDartUnit(Source source) { 1856 List<CompilationUnit> ensureResolvedDartUnits(Source unitSource) {
Brian Wilkerson 2015/02/27 21:56:21 I might be misreading this code, but... It looks
scheglov 2015/02/28 01:34:35 We don't rerun this method. We ask it only only -
1857 SourceEntry sourceEntry = _cache.get(source); 1857 SourceEntry sourceEntry = _cache.get(unitSource);
1858 if (sourceEntry is! DartEntry) { 1858 if (sourceEntry is! DartEntry) {
1859 return null; 1859 return null;
1860 } 1860 }
1861 DartEntry dartEntry = sourceEntry; 1861 DartEntry dartEntry = sourceEntry;
1862 // Check if there is a resolved unit. 1862 // Check every library.
1863 CompilationUnit unit = dartEntry.anyResolvedCompilationUnit; 1863 List<CompilationUnit> units = <CompilationUnit>[];
1864 if (unit != null) { 1864 List<Source> containingLibraries = dartEntry.containingLibraries;
1865 return unit; 1865 for (Source librarySource in containingLibraries) {
1866 CompilationUnit unit =
1867 dartEntry.getValueInLibrary(DartEntry.RESOLVED_UNIT, librarySource);
1868 if (unit == null) {
1869 units = null;
1870 break;
1871 }
1872 units.add(unit);
1866 } 1873 }
1867 // Invalidate the flushed RESOLVED_UNIT to force it eventually. 1874 // Invalidate the flushed RESOLVED_UNIT to force it eventually.
1868 bool shouldBeScheduled = false; 1875 if (units == null) {
1869 List<Source> librariesContaining = dartEntry.containingLibraries; 1876 bool shouldBeScheduled = false;
1870 for (Source librarySource in librariesContaining) { 1877 for (Source librarySource in containingLibraries) {
1871 if (dartEntry.getStateInLibrary(DartEntry.RESOLVED_UNIT, librarySource) == 1878 if (dartEntry.getStateInLibrary(
1872 CacheState.FLUSHED) {
1873 dartEntry.setStateInLibrary(
1874 DartEntry.RESOLVED_UNIT, 1879 DartEntry.RESOLVED_UNIT,
1875 librarySource, 1880 librarySource) ==
1876 CacheState.INVALID); 1881 CacheState.FLUSHED) {
1877 shouldBeScheduled = true; 1882 dartEntry.setStateInLibrary(
1883 DartEntry.RESOLVED_UNIT,
1884 librarySource,
1885 CacheState.INVALID);
1886 shouldBeScheduled = true;
1887 }
1878 } 1888 }
1889 if (shouldBeScheduled) {
1890 _workManager.add(unitSource, SourcePriority.UNKNOWN);
1891 }
1892 // We cannot provide a resolved unit right now,
Paul Berry 2015/02/27 22:05:00 s/a resolved unit/resolved units/
scheglov 2015/02/28 01:34:35 Done.
1893 // but the future analysis will.
1894 return null;
1879 } 1895 }
1880 if (shouldBeScheduled) { 1896 // done
1881 _workManager.add(source, SourcePriority.UNKNOWN); 1897 return units;
1882 }
1883 // We cannot provide a resolved unit right now,
1884 // but the future analysis will.
1885 return null;
1886 } 1898 }
1887 1899
1888 @override 1900 @override
1889 bool exists(Source source) { 1901 bool exists(Source source) {
1890 if (source == null) { 1902 if (source == null) {
1891 return false; 1903 return false;
1892 } 1904 }
1893 if (_contentCache.getContents(source) != null) { 1905 if (_contentCache.getContents(source) != null) {
1894 return true; 1906 return true;
1895 } 1907 }
(...skipping 7905 matching lines...) Expand 10 before | Expand all | Expand 10 after
9801 * 9813 *
9802 * <b>Note:</b> This method cannot be used in an async environment 9814 * <b>Note:</b> This method cannot be used in an async environment
9803 * 9815 *
9804 * @param source the compilation unit for which an AST structure should be ret urned 9816 * @param source the compilation unit for which an AST structure should be ret urned
9805 * @return the AST structure representing the content of the source 9817 * @return the AST structure representing the content of the source
9806 * @throws AnalysisException if the analysis could not be performed 9818 * @throws AnalysisException if the analysis could not be performed
9807 */ 9819 */
9808 CompilationUnit computeResolvableCompilationUnit(Source source); 9820 CompilationUnit computeResolvableCompilationUnit(Source source);
9809 9821
9810 /** 9822 /**
9811 * Return any resolved [CompilationUnit] for the given [source] if not 9823 * Return all the resolved [CompilationUnit]s for the given [source] if not
9812 * flushed, otherwise return `null` and ensures that the [CompilationUnit] 9824 * flushed, otherwise return `null` and ensures that the [CompilationUnit]s
9813 * will be eventually returned to the client from [performAnalysisTask]. 9825 * will be eventually returned to the client from [performAnalysisTask].
9814 */ 9826 */
9815 CompilationUnit ensureAnyResolvedDartUnit(Source source); 9827 List<CompilationUnit> ensureResolvedDartUnits(Source source);
9816 9828
9817 /** 9829 /**
9818 * Return context that owns the given source. 9830 * Return context that owns the given source.
9819 * 9831 *
9820 * @param source the source whose context is to be returned 9832 * @param source the source whose context is to be returned
9821 * @return the context that owns the partition that contains the source 9833 * @return the context that owns the partition that contains the source
9822 */ 9834 */
9823 InternalAnalysisContext getContextFor(Source source); 9835 InternalAnalysisContext getContextFor(Source source);
9824 9836
9825 /** 9837 /**
(...skipping 2661 matching lines...) Expand 10 before | Expand all | Expand 10 after
12487 if (element.id == _id) { 12499 if (element.id == _id) {
12488 result = element; 12500 result = element;
12489 throw new _ElementByIdFinderException(); 12501 throw new _ElementByIdFinderException();
12490 } 12502 }
12491 super.visitElement(element); 12503 super.visitElement(element);
12492 } 12504 }
12493 } 12505 }
12494 12506
12495 class _ElementByIdFinderException { 12507 class _ElementByIdFinderException {
12496 } 12508 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698