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 analysis.server; | 5 library analysis.server; |
6 | 6 |
7 import 'dart:async'; | 7 import 'dart:async'; |
8 import 'dart:collection'; | 8 import 'dart:collection'; |
9 import 'dart:math' show max; | 9 import 'dart:math' show max; |
10 | 10 |
(...skipping 1002 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1013 } | 1013 } |
1014 } else if (change is RemoveContentOverlay) { | 1014 } else if (change is RemoveContentOverlay) { |
1015 newContents = null; | 1015 newContents = null; |
1016 } else { | 1016 } else { |
1017 // Protocol parsing should have ensured that we never get here. | 1017 // Protocol parsing should have ensured that we never get here. |
1018 throw new AnalysisException('Illegal change type'); | 1018 throw new AnalysisException('Illegal change type'); |
1019 } | 1019 } |
1020 overlayState.setContents(source, newContents); | 1020 overlayState.setContents(source, newContents); |
1021 // Update all contexts. | 1021 // Update all contexts. |
1022 for (InternalAnalysisContext context in folderMap.values) { | 1022 for (InternalAnalysisContext context in folderMap.values) { |
1023 if (context.handleContentsChanged( | 1023 List<Source> sources = context.getSourcesWithFullName(file); |
1024 source, oldContents, newContents, true)) { | 1024 sources.forEach((Source source) { |
1025 schedulePerformAnalysisOperation(context); | 1025 if (context.handleContentsChanged( |
1026 } else { | 1026 source, oldContents, newContents, true)) { |
1027 // When the client sends any change for a source, we should resend | 1027 schedulePerformAnalysisOperation(context); |
1028 // subscribed notifications, even if there were no changes in the | 1028 } else { |
1029 // source contents. | 1029 // When the client sends any change for a source, we should resend |
1030 // TODO(scheglov) consider checking if there are subscriptions. | 1030 // subscribed notifications, even if there were no changes in the |
1031 if (AnalysisEngine.isDartFileName(file)) { | 1031 // source contents. |
1032 List<CompilationUnit> dartUnits = | 1032 // TODO(scheglov) consider checking if there are subscriptions. |
1033 context.ensureResolvedDartUnits(source); | 1033 if (AnalysisEngine.isDartFileName(file)) { |
1034 if (dartUnits != null) { | 1034 List<CompilationUnit> dartUnits = |
1035 AnalysisErrorInfo errorInfo = context.getErrors(source); | 1035 context.ensureResolvedDartUnits(source); |
1036 for (var dartUnit in dartUnits) { | 1036 if (dartUnits != null) { |
1037 scheduleNotificationOperations(this, file, errorInfo.lineInfo, | 1037 AnalysisErrorInfo errorInfo = context.getErrors(source); |
1038 context, null, dartUnit, errorInfo.errors); | 1038 for (var dartUnit in dartUnits) { |
1039 scheduleIndexOperation(this, file, context, dartUnit); | 1039 scheduleNotificationOperations(this, file, errorInfo.lineInfo, |
| 1040 context, null, dartUnit, errorInfo.errors); |
| 1041 scheduleIndexOperation(this, file, context, dartUnit); |
| 1042 } |
| 1043 } else { |
| 1044 schedulePerformAnalysisOperation(context); |
1040 } | 1045 } |
1041 } else { | |
1042 schedulePerformAnalysisOperation(context); | |
1043 } | 1046 } |
1044 } | 1047 } |
1045 } | 1048 }); |
1046 } | 1049 } |
1047 }); | 1050 }); |
1048 } | 1051 } |
1049 | 1052 |
1050 /** | 1053 /** |
1051 * Use the given updaters to update the values of the options in every | 1054 * Use the given updaters to update the values of the options in every |
1052 * existing analysis context. | 1055 * existing analysis context. |
1053 */ | 1056 */ |
1054 void updateOptions(List<OptionUpdater> optionUpdaters) { | 1057 void updateOptions(List<OptionUpdater> optionUpdaters) { |
1055 // | 1058 // |
(...skipping 308 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1364 /** | 1367 /** |
1365 * The [PerformanceTag] for time spent in server request handlers. | 1368 * The [PerformanceTag] for time spent in server request handlers. |
1366 */ | 1369 */ |
1367 static PerformanceTag serverRequests = new PerformanceTag('serverRequests'); | 1370 static PerformanceTag serverRequests = new PerformanceTag('serverRequests'); |
1368 | 1371 |
1369 /** | 1372 /** |
1370 * The [PerformanceTag] for time spent in split store microtasks. | 1373 * The [PerformanceTag] for time spent in split store microtasks. |
1371 */ | 1374 */ |
1372 static PerformanceTag splitStore = new PerformanceTag('splitStore'); | 1375 static PerformanceTag splitStore = new PerformanceTag('splitStore'); |
1373 } | 1376 } |
OLD | NEW |