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

Side by Side Diff: pkg/analysis_server/lib/src/operation/operation_analysis.dart

Issue 876703003: Issue 22155. Send outline for both parsed and resolved Dart units. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 years, 11 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 | Annotate | Revision Log
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 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';
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after
167 167
168 /** 168 /**
169 * Send the information in the given list of notices back to the client. 169 * Send the information in the given list of notices back to the client.
170 */ 170 */
171 void _sendNotices(AnalysisServer server, List<ChangeNotice> notices) { 171 void _sendNotices(AnalysisServer server, List<ChangeNotice> notices) {
172 for (int i = 0; i < notices.length; i++) { 172 for (int i = 0; i < notices.length; i++) {
173 ChangeNotice notice = notices[i]; 173 ChangeNotice notice = notices[i];
174 Source source = notice.source; 174 Source source = notice.source;
175 String file = source.fullName; 175 String file = source.fullName;
176 // Dart 176 // Dart
177 CompilationUnit dartUnit = notice.compilationUnit; 177 CompilationUnit parsedDartUnit = notice.parsedDartUnit;
178 if (dartUnit != null) { 178 CompilationUnit resolvedDartUnit = notice.compilationUnit;
179 if (notice.resolved) { 179 CompilationUnit dartUnit =
180 if (server.hasAnalysisSubscription( 180 resolvedDartUnit != null ? resolvedDartUnit : parsedDartUnit;
181 protocol.AnalysisService.HIGHLIGHTS, 181 if (resolvedDartUnit != null) {
182 file)) { 182 if (server.hasAnalysisSubscription(
183 server.addOperation(new _DartHighlightsOperation(file, dartUnit)); 183 protocol.AnalysisService.HIGHLIGHTS,
184 } 184 file)) {
185 if (server.hasAnalysisSubscription( 185 server.addOperation(
186 protocol.AnalysisService.NAVIGATION, 186 new _DartHighlightsOperation(file, resolvedDartUnit));
187 file)) { 187 }
188 server.addOperation(new _DartNavigationOperation(file, dartUnit)); 188 if (server.hasAnalysisSubscription(
189 } 189 protocol.AnalysisService.NAVIGATION,
190 if (server.hasAnalysisSubscription( 190 file)) {
191 protocol.AnalysisService.OCCURRENCES, 191 server.addOperation(
192 file)) { 192 new _DartNavigationOperation(file, resolvedDartUnit));
193 server.addOperation(new _DartOccurrencesOperation(file, dartUnit)); 193 }
194 } 194 if (server.hasAnalysisSubscription(
195 if (server.hasAnalysisSubscription( 195 protocol.AnalysisService.OCCURRENCES,
196 protocol.AnalysisService.OVERRIDES, 196 file)) {
197 file)) { 197 server.addOperation(
198 server.addOperation(new _DartOverridesOperation(file, dartUnit)); 198 new _DartOccurrencesOperation(file, resolvedDartUnit));
199 } 199 }
200 } else { 200 if (server.hasAnalysisSubscription(
201 if (server.hasAnalysisSubscription( 201 protocol.AnalysisService.OVERRIDES,
202 protocol.AnalysisService.OUTLINE, 202 file)) {
203 file)) { 203 server.addOperation(
204 LineInfo lineInfo = notice.lineInfo; 204 new _DartOverridesOperation(file, resolvedDartUnit));
205 server.addOperation(
206 new _DartOutlineOperation(file, lineInfo, dartUnit));
207 }
208 } 205 }
209 } 206 }
207 if (dartUnit != null) {
208 if (server.hasAnalysisSubscription(
209 protocol.AnalysisService.OUTLINE,
210 file)) {
211 LineInfo lineInfo = notice.lineInfo;
212 server.addOperation(
213 new _DartOutlineOperation(file, lineInfo, dartUnit));
214 }
215 }
216 // errors
210 if (server.shouldSendErrorsNotificationFor(file)) { 217 if (server.shouldSendErrorsNotificationFor(file)) {
211 server.addOperation( 218 server.addOperation(
212 new _NotificationErrorsOperation(file, notice.lineInfo, notice.error s)); 219 new _NotificationErrorsOperation(file, notice.lineInfo, notice.error s));
213 } 220 }
221 // done
214 server.fileAnalyzed(notice); 222 server.fileAnalyzed(notice);
215 } 223 }
216 } 224 }
217 225
218 void _setCacheSize(int cacheSize) { 226 void _setCacheSize(int cacheSize) {
219 AnalysisOptionsImpl options = 227 AnalysisOptionsImpl options =
220 new AnalysisOptionsImpl.con1(context.analysisOptions); 228 new AnalysisOptionsImpl.con1(context.analysisOptions);
221 options.cacheSize = cacheSize; 229 options.cacheSize = cacheSize;
222 context.analysisOptions = options; 230 context.analysisOptions = options;
223 } 231 }
224 232
225 void _updateIndex(AnalysisServer server, List<ChangeNotice> notices) { 233 void _updateIndex(AnalysisServer server, List<ChangeNotice> notices) {
226 Index index = server.index; 234 Index index = server.index;
227 if (index == null) { 235 if (index == null) {
228 return; 236 return;
229 } 237 }
230 for (ChangeNotice notice in notices) { 238 for (ChangeNotice notice in notices) {
231 // Dart 239 // Dart
232 if (notice.resolved) { 240 try {
233 try { 241 CompilationUnit dartUnit = notice.compilationUnit;
234 CompilationUnit dartUnit = notice.compilationUnit; 242 if (dartUnit != null) {
235 if (dartUnit != null) { 243 server.addOperation(new _DartIndexOperation(context, dartUnit));
236 server.addOperation(new _DartIndexOperation(context, dartUnit));
237 }
238 } catch (exception, stackTrace) {
239 server.sendServerErrorNotification(exception, stackTrace);
240 } 244 }
241 // HTML 245 } catch (exception, stackTrace) {
242 try { 246 server.sendServerErrorNotification(exception, stackTrace);
243 HtmlUnit htmlUnit = notice.htmlUnit; 247 }
244 if (htmlUnit != null) { 248 // HTML
245 server.addOperation(new _HtmlIndexOperation(context, htmlUnit)); 249 try {
246 } 250 HtmlUnit htmlUnit = notice.htmlUnit;
247 } catch (exception, stackTrace) { 251 if (htmlUnit != null) {
248 server.sendServerErrorNotification(exception, stackTrace); 252 server.addOperation(new _HtmlIndexOperation(context, htmlUnit));
249 } 253 }
254 } catch (exception, stackTrace) {
255 server.sendServerErrorNotification(exception, stackTrace);
250 } 256 }
251 } 257 }
252 } 258 }
253 } 259 }
254 260
255 261
256 class _DartHighlightsOperation extends _DartNotificationOperation { 262 class _DartHighlightsOperation extends _DartNotificationOperation {
257 _DartHighlightsOperation(String file, CompilationUnit unit) 263 _DartHighlightsOperation(String file, CompilationUnit unit)
258 : super(file, unit); 264 : super(file, unit);
259 265
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
371 @override 377 @override
372 ServerOperationPriority get priority { 378 ServerOperationPriority get priority {
373 return ServerOperationPriority.ANALYSIS_NOTIFICATION; 379 return ServerOperationPriority.ANALYSIS_NOTIFICATION;
374 } 380 }
375 381
376 @override 382 @override
377 void perform(AnalysisServer server) { 383 void perform(AnalysisServer server) {
378 sendAnalysisNotificationErrors(server, file, lineInfo, errors); 384 sendAnalysisNotificationErrors(server, file, lineInfo, errors);
379 } 385 }
380 } 386 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698