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

Side by Side Diff: pkg/analyzer/lib/src/context/context.dart

Issue 1410813003: Reset AnalysisDriver after changes. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 2 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
« no previous file with comments | « no previous file | pkg/analyzer/test/src/context/context_test.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/instrumentation/instrumentation.dart'; 10 import 'package:analyzer/instrumentation/instrumentation.dart';
(...skipping 1713 matching lines...) Expand 10 before | Expand all | Expand 10 after
1724 if (newOrder.length < count) { 1724 if (newOrder.length < count) {
1725 analysisPriorityOrder = newOrder; 1725 analysisPriorityOrder = newOrder;
1726 } 1726 }
1727 } 1727 }
1728 1728
1729 /** 1729 /**
1730 * Create an entry for the newly added [source] and invalidate any sources 1730 * Create an entry for the newly added [source] and invalidate any sources
1731 * that referenced the source before it existed. 1731 * that referenced the source before it existed.
1732 */ 1732 */
1733 void _sourceAvailable(Source source) { 1733 void _sourceAvailable(Source source) {
1734 driver.reset();
1734 // TODO(brianwilkerson) This method needs to check whether the source was 1735 // TODO(brianwilkerson) This method needs to check whether the source was
1735 // previously being implicitly analyzed. If so, the cache entry needs to be 1736 // previously being implicitly analyzed. If so, the cache entry needs to be
1736 // update to reflect the new status and an event needs to be generated to 1737 // update to reflect the new status and an event needs to be generated to
1737 // inform clients that it is no longer being implicitly analyzed. 1738 // inform clients that it is no longer being implicitly analyzed.
1738 CacheEntry entry = _cache.get(source); 1739 CacheEntry entry = _cache.get(source);
1739 if (entry == null) { 1740 if (entry == null) {
1740 _createCacheEntry(source, true); 1741 _createCacheEntry(source, true);
1741 } else { 1742 } else {
1742 entry.modificationTime = getModificationStamp(source); 1743 entry.modificationTime = getModificationStamp(source);
1743 entry.setState(CONTENT, CacheState.INVALID); 1744 entry.setState(CONTENT, CacheState.INVALID);
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
1800 // 'dartDelta: add=${dartDelta.addedNames} remove=${dartDelta.r emovedNames}'); 1801 // 'dartDelta: add=${dartDelta.addedNames} remove=${dartDelta.r emovedNames}');
1801 delta = dartDelta; 1802 delta = dartDelta;
1802 entry.setState(CONTENT, CacheState.INVALID, delta: delta); 1803 entry.setState(CONTENT, CacheState.INVALID, delta: delta);
1803 return; 1804 return;
1804 } 1805 }
1805 } 1806 }
1806 } 1807 }
1807 } 1808 }
1808 entry.setState(CONTENT, CacheState.INVALID); 1809 entry.setState(CONTENT, CacheState.INVALID);
1809 } 1810 }
1811 driver.reset();
1810 for (WorkManager workManager in workManagers) { 1812 for (WorkManager workManager in workManagers) {
1811 workManager.applyChange( 1813 workManager.applyChange(
1812 Source.EMPTY_LIST, <Source>[source], Source.EMPTY_LIST); 1814 Source.EMPTY_LIST, <Source>[source], Source.EMPTY_LIST);
1813 } 1815 }
1814 } 1816 }
1815 1817
1816 /** 1818 /**
1817 * Record that the give [source] has been deleted. 1819 * Record that the give [source] has been deleted.
1818 */ 1820 */
1819 void _sourceDeleted(Source source) { 1821 void _sourceDeleted(Source source) {
(...skipping 21 matching lines...) Expand all
1841 // new AnalysisException("This source was marked as being deleted"), 1843 // new AnalysisException("This source was marked as being deleted"),
1842 // null)); 1844 // null));
1843 // } 1845 // }
1844 _removeFromPriorityOrder(source); 1846 _removeFromPriorityOrder(source);
1845 } 1847 }
1846 1848
1847 /** 1849 /**
1848 * Record that the given [source] has been removed. 1850 * Record that the given [source] has been removed.
1849 */ 1851 */
1850 void _sourceRemoved(Source source) { 1852 void _sourceRemoved(Source source) {
1853 driver.reset();
1851 _removeFromCache(source); 1854 _removeFromCache(source);
1852 _removeFromPriorityOrder(source); 1855 _removeFromPriorityOrder(source);
1853 } 1856 }
1854 1857
1855 /** 1858 /**
1856 * TODO(scheglov) A hackish, limited incremental resolution implementation. 1859 * TODO(scheglov) A hackish, limited incremental resolution implementation.
1857 */ 1860 */
1858 bool _tryPoorMansIncrementalResolution(Source unitSource, String newCode) { 1861 bool _tryPoorMansIncrementalResolution(Source unitSource, String newCode) {
1859 return PerformanceStatistics.incrementalAnalysis.makeCurrentWhile(() { 1862 return PerformanceStatistics.incrementalAnalysis.makeCurrentWhile(() {
1860 incrementalResolutionValidation_lastUnitSource = null; 1863 incrementalResolutionValidation_lastUnitSource = null;
(...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after
2106 }); 2109 });
2107 if (!pendingFuture.evaluate(entry)) { 2110 if (!pendingFuture.evaluate(entry)) {
2108 _context._pendingFutureTargets 2111 _context._pendingFutureTargets
2109 .putIfAbsent(_target, () => <PendingFuture>[]) 2112 .putIfAbsent(_target, () => <PendingFuture>[])
2110 .add(pendingFuture); 2113 .add(pendingFuture);
2111 _context.dartWorkManager.addPriorityResult(_target, _descriptor); 2114 _context.dartWorkManager.addPriorityResult(_target, _descriptor);
2112 } 2115 }
2113 return pendingFuture.future; 2116 return pendingFuture.future;
2114 } 2117 }
2115 } 2118 }
OLDNEW
« no previous file with comments | « no previous file | pkg/analyzer/test/src/context/context_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698