| 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 library engine.incremental_resolver; | 5 library engine.incremental_resolver; |
| 6 | 6 |
| 7 import 'dart:collection'; | 7 import 'dart:collection'; |
| 8 import 'dart:math' as math; | 8 import 'dart:math' as math; |
| 9 | 9 |
| 10 import 'package:analyzer/src/context/cache.dart' | 10 import 'package:analyzer/src/context/cache.dart' |
| (...skipping 846 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 857 @override | 857 @override |
| 858 DeltaResult validate(InternalAnalysisContext context, AnalysisTarget target, | 858 DeltaResult validate(InternalAnalysisContext context, AnalysisTarget target, |
| 859 ResultDescriptor descriptor) { | 859 ResultDescriptor descriptor) { |
| 860 // don't invalidate results of standard Dart tasks | 860 // don't invalidate results of standard Dart tasks |
| 861 bool isByTask(TaskDescriptor taskDescriptor) { | 861 bool isByTask(TaskDescriptor taskDescriptor) { |
| 862 return taskDescriptor.results.contains(descriptor); | 862 return taskDescriptor.results.contains(descriptor); |
| 863 } | 863 } |
| 864 if (descriptor == CONTENT) { | 864 if (descriptor == CONTENT) { |
| 865 return DeltaResult.KEEP_CONTINUE; | 865 return DeltaResult.KEEP_CONTINUE; |
| 866 } | 866 } |
| 867 if (target is Source && target != source) { |
| 868 if (isByTask(DartErrorsTask.DESCRIPTOR) || |
| 869 isByTask(LibraryErrorsReadyTask.DESCRIPTOR)) { |
| 870 return DeltaResult.KEEP_CONTINUE; |
| 871 } |
| 872 } |
| 873 if (target is LibrarySpecificUnit && |
| 874 target.unit != source && |
| 875 target.library != source) { |
| 876 if (isByTask(GatherUsedLocalElementsTask.DESCRIPTOR) || |
| 877 isByTask(GatherUsedImportedElementsTask.DESCRIPTOR) || |
| 878 isByTask(GenerateHintsTask.DESCRIPTOR) || |
| 879 isByTask(LibraryUnitErrorsTask.DESCRIPTOR)) { |
| 880 return DeltaResult.KEEP_CONTINUE; |
| 881 } |
| 882 } |
| 867 if (isByTask(BuildCompilationUnitElementTask.DESCRIPTOR) || | 883 if (isByTask(BuildCompilationUnitElementTask.DESCRIPTOR) || |
| 868 isByTask(BuildDirectiveElementsTask.DESCRIPTOR) || | 884 isByTask(BuildDirectiveElementsTask.DESCRIPTOR) || |
| 869 isByTask(BuildEnumMemberElementsTask.DESCRIPTOR) || | 885 isByTask(BuildEnumMemberElementsTask.DESCRIPTOR) || |
| 870 isByTask(BuildExportNamespaceTask.DESCRIPTOR) || | 886 isByTask(BuildExportNamespaceTask.DESCRIPTOR) || |
| 871 isByTask(BuildLibraryElementTask.DESCRIPTOR) || | 887 isByTask(BuildLibraryElementTask.DESCRIPTOR) || |
| 872 isByTask(BuildPublicNamespaceTask.DESCRIPTOR) || | 888 isByTask(BuildPublicNamespaceTask.DESCRIPTOR) || |
| 873 isByTask(BuildSourceExportClosureTask.DESCRIPTOR) || | 889 isByTask(BuildSourceExportClosureTask.DESCRIPTOR) || |
| 874 isByTask(BuildSourceImportExportClosureTask.DESCRIPTOR) || | 890 isByTask(BuildSourceImportExportClosureTask.DESCRIPTOR) || |
| 875 isByTask(ComputeConstantDependenciesTask.DESCRIPTOR) || | 891 isByTask(ComputeConstantDependenciesTask.DESCRIPTOR) || |
| 876 isByTask(ComputeConstantValueTask.DESCRIPTOR) || | 892 isByTask(ComputeConstantValueTask.DESCRIPTOR) || |
| (...skipping 367 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1244 } | 1260 } |
| 1245 | 1261 |
| 1246 void _shiftErrors_OLD(DataDescriptor<List<AnalysisError>> descriptor) { | 1262 void _shiftErrors_OLD(DataDescriptor<List<AnalysisError>> descriptor) { |
| 1247 List<AnalysisError> errors = | 1263 List<AnalysisError> errors = |
| 1248 oldEntry.getValueInLibrary(descriptor, _librarySource); | 1264 oldEntry.getValueInLibrary(descriptor, _librarySource); |
| 1249 _shiftErrors(errors); | 1265 _shiftErrors(errors); |
| 1250 } | 1266 } |
| 1251 | 1267 |
| 1252 void _updateCache() { | 1268 void _updateCache() { |
| 1253 if (newSourceEntry != null) { | 1269 if (newSourceEntry != null) { |
| 1254 newSourceEntry.setState(CONTENT, CacheState.INVALID, | 1270 LoggingTimer timer = logger.startTimer(); |
| 1255 delta: new IncrementalBodyDelta(_source, _updateOffset, _updateEndOld, | 1271 try { |
| 1256 _updateEndNew, _updateDelta)); | 1272 newSourceEntry.setState(CONTENT, CacheState.INVALID, |
| 1273 delta: new IncrementalBodyDelta(_source, _updateOffset, |
| 1274 _updateEndOld, _updateEndNew, _updateDelta)); |
| 1275 } finally { |
| 1276 timer.stop('invalidate cache with delta'); |
| 1277 } |
| 1257 } | 1278 } |
| 1258 } | 1279 } |
| 1259 | 1280 |
| 1260 void _updateElementNameOffsets() { | 1281 void _updateElementNameOffsets() { |
| 1261 LoggingTimer timer = logger.startTimer(); | 1282 LoggingTimer timer = logger.startTimer(); |
| 1262 try { | 1283 try { |
| 1263 _definingUnit | 1284 _definingUnit |
| 1264 .accept(new _ElementNameOffsetUpdater(_updateOffset, _updateDelta)); | 1285 .accept(new _ElementNameOffsetUpdater(_updateOffset, _updateDelta)); |
| 1265 } finally { | 1286 } finally { |
| 1266 timer.stop('update element offsets'); | 1287 timer.stop('update element offsets'); |
| (...skipping 853 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2120 @override | 2141 @override |
| 2121 String toString() => name; | 2142 String toString() => name; |
| 2122 } | 2143 } |
| 2123 | 2144 |
| 2124 class _TokenPair { | 2145 class _TokenPair { |
| 2125 final _TokenDifferenceKind kind; | 2146 final _TokenDifferenceKind kind; |
| 2126 final Token oldToken; | 2147 final Token oldToken; |
| 2127 final Token newToken; | 2148 final Token newToken; |
| 2128 _TokenPair(this.kind, this.oldToken, this.newToken); | 2149 _TokenPair(this.kind, this.oldToken, this.newToken); |
| 2129 } | 2150 } |
| OLD | NEW |