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

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

Issue 1218573003: Try to use incremental resolution after removing overlays. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 5 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
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:async'; 10 import 'dart:async';
(...skipping 2152 matching lines...) Expand 10 before | Expand all | Expand 10 after
2163 2163
2164 @override 2164 @override
2165 bool handleContentsChanged( 2165 bool handleContentsChanged(
2166 Source source, String originalContents, String newContents, bool notify) { 2166 Source source, String originalContents, String newContents, bool notify) {
2167 SourceEntry sourceEntry = _cache.get(source); 2167 SourceEntry sourceEntry = _cache.get(source);
2168 if (sourceEntry == null) { 2168 if (sourceEntry == null) {
2169 return false; 2169 return false;
2170 } 2170 }
2171 bool changed = newContents != originalContents; 2171 bool changed = newContents != originalContents;
2172 if (newContents != null) { 2172 if (newContents != null) {
2173 if (newContents != originalContents) { 2173 if (changed) {
2174 _incrementalAnalysisCache = 2174 _incrementalAnalysisCache =
2175 IncrementalAnalysisCache.clear(_incrementalAnalysisCache, source); 2175 IncrementalAnalysisCache.clear(_incrementalAnalysisCache, source);
2176 if (!analysisOptions.incremental || 2176 if (!analysisOptions.incremental ||
2177 !_tryPoorMansIncrementalResolution(source, newContents)) { 2177 !_tryPoorMansIncrementalResolution(source, newContents)) {
2178 _sourceChanged(source); 2178 _sourceChanged(source);
2179 } 2179 }
2180 sourceEntry.modificationTime = 2180 sourceEntry.modificationTime =
2181 _contentCache.getModificationStamp(source); 2181 _contentCache.getModificationStamp(source);
2182 sourceEntry.setValue(SourceEntry.CONTENT, newContents); 2182 sourceEntry.setValue(SourceEntry.CONTENT, newContents);
2183 } else { 2183 } else {
2184 sourceEntry.modificationTime = 2184 sourceEntry.modificationTime =
2185 _contentCache.getModificationStamp(source); 2185 _contentCache.getModificationStamp(source);
2186 } 2186 }
2187 } else if (originalContents != null) { 2187 } else if (originalContents != null) {
2188 _incrementalAnalysisCache = 2188 _incrementalAnalysisCache =
2189 IncrementalAnalysisCache.clear(_incrementalAnalysisCache, source); 2189 IncrementalAnalysisCache.clear(_incrementalAnalysisCache, source);
2190 changed = newContents != originalContents;
2191 // We are removing the overlay for the file, check if the file's 2190 // We are removing the overlay for the file, check if the file's
2192 // contents is the same as it was in the overlay. 2191 // contents is the same as it was in the overlay.
2193 try { 2192 try {
2194 TimestampedData<String> fileContents = getContents(source); 2193 TimestampedData<String> fileContents = getContents(source);
2195 String fileContentsData = fileContents.data; 2194 String fileContentsData = fileContents.data;
2196 if (fileContentsData == originalContents) { 2195 if (fileContentsData == originalContents) {
2197 sourceEntry.setValue(SourceEntry.CONTENT, fileContentsData); 2196 sourceEntry.setValue(SourceEntry.CONTENT, fileContentsData);
2198 sourceEntry.modificationTime = fileContents.modificationTime; 2197 sourceEntry.modificationTime = fileContents.modificationTime;
2199 changed = false; 2198 changed = false;
2200 } 2199 }
2200 newContents = fileContentsData;
2201 } catch (e) {} 2201 } catch (e) {}
2202 // If not the same content (e.g. the file is being closed without save), 2202 // If not the same content (e.g. the file is being closed without save),
2203 // then force analysis. 2203 // then force analysis.
2204 if (changed) { 2204 if (changed) {
2205 _sourceChanged(source); 2205 if (!analysisOptions.incremental ||
2206 !_tryPoorMansIncrementalResolution(source, newContents)) {
2207 _sourceChanged(source);
2208 }
2206 } 2209 }
2207 } 2210 }
2208 if (notify && changed) { 2211 if (notify && changed) {
2209 _onSourcesChangedController 2212 _onSourcesChangedController
2210 .add(new SourcesChangedEvent.changedContent(source, newContents)); 2213 .add(new SourcesChangedEvent.changedContent(source, newContents));
2211 } 2214 }
2212 return changed; 2215 return changed;
2213 } 2216 }
2214 2217
2215 @override 2218 @override
(...skipping 9624 matching lines...) Expand 10 before | Expand all | Expand 10 after
11840 PendingFuture pendingFuture = 11843 PendingFuture pendingFuture =
11841 new PendingFuture<T>(_context, source, computeValue); 11844 new PendingFuture<T>(_context, source, computeValue);
11842 if (!pendingFuture.evaluate(sourceEntry)) { 11845 if (!pendingFuture.evaluate(sourceEntry)) {
11843 _context._pendingFutureSources 11846 _context._pendingFutureSources
11844 .putIfAbsent(source, () => <PendingFuture>[]) 11847 .putIfAbsent(source, () => <PendingFuture>[])
11845 .add(pendingFuture); 11848 .add(pendingFuture);
11846 } 11849 }
11847 return pendingFuture.future; 11850 return pendingFuture.future;
11848 } 11851 }
11849 } 11852 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698