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 operation.analysis; | 5 library operation.analysis; |
6 | 6 |
7 import 'package:analysis_server/src/analysis_server.dart'; | 7 import 'package:analysis_server/src/analysis_server.dart'; |
8 import 'package:analysis_server/src/computer/computer_highlights.dart'; | 8 import 'package:analysis_server/src/computer/computer_highlights.dart'; |
9 import 'package:analysis_server/src/computer/computer_navigation.dart'; | 9 import 'package:analysis_server/src/computer/computer_navigation.dart'; |
10 import 'package:analysis_server/src/computer/computer_occurrences.dart'; | 10 import 'package:analysis_server/src/computer/computer_occurrences.dart'; |
11 import 'package:analysis_server/src/computer/computer_outline.dart'; | 11 import 'package:analysis_server/src/computer/computer_outline.dart'; |
| 12 import 'package:analysis_server/src/computer/computer_overrides.dart'; |
12 import 'package:analysis_server/src/constants.dart'; | 13 import 'package:analysis_server/src/constants.dart'; |
13 import 'package:analysis_server/src/operation/operation.dart'; | 14 import 'package:analysis_server/src/operation/operation.dart'; |
14 import 'package:analysis_server/src/protocol.dart'; | 15 import 'package:analysis_server/src/protocol.dart'; |
15 import 'package:analyzer/src/generated/ast.dart'; | 16 import 'package:analyzer/src/generated/ast.dart'; |
16 import 'package:analyzer/src/generated/engine.dart'; | 17 import 'package:analyzer/src/generated/engine.dart'; |
17 import 'package:analyzer/src/generated/error.dart'; | 18 import 'package:analyzer/src/generated/error.dart'; |
18 import 'package:analyzer/src/generated/html.dart'; | 19 import 'package:analyzer/src/generated/html.dart'; |
19 import 'package:analyzer/src/generated/index.dart'; | 20 import 'package:analyzer/src/generated/index.dart'; |
20 import 'package:analyzer/src/generated/java_core.dart'; | 21 import 'package:analyzer/src/generated/java_core.dart'; |
21 import 'package:analyzer/src/generated/source.dart'; | 22 import 'package:analyzer/src/generated/source.dart'; |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
98 void sendAnalysisNotificationOutline(AnalysisServer server, | 99 void sendAnalysisNotificationOutline(AnalysisServer server, |
99 AnalysisContext context, Source source, CompilationUnit dartUnit) { | 100 AnalysisContext context, Source source, CompilationUnit dartUnit) { |
100 Notification notification = new Notification(ANALYSIS_OUTLINE); | 101 Notification notification = new Notification(ANALYSIS_OUTLINE); |
101 notification.setParameter(FILE, source.fullName); | 102 notification.setParameter(FILE, source.fullName); |
102 notification.setParameter(OUTLINE, new DartUnitOutlineComputer(context, | 103 notification.setParameter(OUTLINE, new DartUnitOutlineComputer(context, |
103 source, dartUnit).compute()); | 104 source, dartUnit).compute()); |
104 server.sendNotification(notification); | 105 server.sendNotification(notification); |
105 } | 106 } |
106 | 107 |
107 | 108 |
| 109 void sendAnalysisNotificationOverrides(AnalysisServer server, |
| 110 String file, CompilationUnit dartUnit) { |
| 111 Notification notification = new Notification(ANALYSIS_OVERRIDES); |
| 112 notification.setParameter(FILE, file); |
| 113 notification.setParameter(OVERRIDES, new DartUnitOverridesComputer( |
| 114 dartUnit).compute()); |
| 115 server.sendNotification(notification); |
| 116 } |
| 117 |
| 118 |
108 /** | 119 /** |
109 * Instances of [PerformAnalysisOperation] perform a single analysis task. | 120 * Instances of [PerformAnalysisOperation] perform a single analysis task. |
110 */ | 121 */ |
111 class PerformAnalysisOperation extends ServerOperation { | 122 class PerformAnalysisOperation extends ServerOperation { |
112 final AnalysisContext context; | 123 final AnalysisContext context; |
113 final bool isContinue; | 124 final bool isContinue; |
114 | 125 |
115 PerformAnalysisOperation(this.context, this.isContinue); | 126 PerformAnalysisOperation(this.context, this.isContinue); |
116 | 127 |
117 @override | 128 @override |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
162 } | 173 } |
163 if (server.hasAnalysisSubscription(AnalysisService.NAVIGATION, file)) { | 174 if (server.hasAnalysisSubscription(AnalysisService.NAVIGATION, file)) { |
164 sendAnalysisNotificationNavigation(server, file, dartUnit); | 175 sendAnalysisNotificationNavigation(server, file, dartUnit); |
165 } | 176 } |
166 if (server.hasAnalysisSubscription(AnalysisService.OCCURRENCES, file)) { | 177 if (server.hasAnalysisSubscription(AnalysisService.OCCURRENCES, file)) { |
167 sendAnalysisNotificationOccurrences(server, file, dartUnit); | 178 sendAnalysisNotificationOccurrences(server, file, dartUnit); |
168 } | 179 } |
169 if (server.hasAnalysisSubscription(AnalysisService.OUTLINE, file)) { | 180 if (server.hasAnalysisSubscription(AnalysisService.OUTLINE, file)) { |
170 sendAnalysisNotificationOutline(server, context, source, dartUnit); | 181 sendAnalysisNotificationOutline(server, context, source, dartUnit); |
171 } | 182 } |
| 183 if (server.hasAnalysisSubscription(AnalysisService.OVERRIDES, file)) { |
| 184 sendAnalysisNotificationOverrides(server, file, dartUnit); |
| 185 } |
172 } | 186 } |
173 // TODO(scheglov) use default subscriptions | 187 // TODO(scheglov) use default subscriptions |
174 if (!source.isInSystemLibrary) { | 188 if (!source.isInSystemLibrary) { |
175 sendAnalysisNotificationErrors(server, file, notice.lineInfo, | 189 sendAnalysisNotificationErrors(server, file, notice.lineInfo, |
176 notice.errors); | 190 notice.errors); |
177 } | 191 } |
178 } | 192 } |
179 } | 193 } |
180 | 194 |
181 void updateIndex(Index index, List<ChangeNotice> notices) { | 195 void updateIndex(Index index, List<ChangeNotice> notices) { |
(...skipping 11 matching lines...) Expand all Loading... |
193 // HTML | 207 // HTML |
194 { | 208 { |
195 HtmlUnit htmlUnit = notice.htmlUnit; | 209 HtmlUnit htmlUnit = notice.htmlUnit; |
196 if (htmlUnit != null) { | 210 if (htmlUnit != null) { |
197 index.indexHtmlUnit(context, htmlUnit); | 211 index.indexHtmlUnit(context, htmlUnit); |
198 } | 212 } |
199 } | 213 } |
200 } | 214 } |
201 } | 215 } |
202 } | 216 } |
OLD | NEW |