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

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

Issue 842533004: Return outline after parse (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 * Send the information in the given list of notices back to the client. 167 * Send the information in the given list of notices back to the client.
168 */ 168 */
169 void _sendNotices(AnalysisServer server, List<ChangeNotice> notices) { 169 void _sendNotices(AnalysisServer server, List<ChangeNotice> notices) {
170 for (int i = 0; i < notices.length; i++) { 170 for (int i = 0; i < notices.length; i++) {
171 ChangeNotice notice = notices[i]; 171 ChangeNotice notice = notices[i];
172 Source source = notice.source; 172 Source source = notice.source;
173 String file = source.fullName; 173 String file = source.fullName;
174 // Dart 174 // Dart
175 CompilationUnit dartUnit = notice.compilationUnit; 175 CompilationUnit dartUnit = notice.compilationUnit;
176 if (dartUnit != null) { 176 if (dartUnit != null) {
177 if (server.hasAnalysisSubscription( 177 if (notice.resolved) {
178 protocol.AnalysisService.HIGHLIGHTS, 178 if (server.hasAnalysisSubscription(
179 file)) { 179 protocol.AnalysisService.HIGHLIGHTS,
180 server.addOperation(new _DartHighlightsOperation(file, dartUnit)); 180 file)) {
181 } 181 server.addOperation(new _DartHighlightsOperation(file, dartUnit));
182 if (server.hasAnalysisSubscription( 182 }
183 protocol.AnalysisService.NAVIGATION, 183 if (server.hasAnalysisSubscription(
184 file)) { 184 protocol.AnalysisService.NAVIGATION,
185 server.addOperation(new _DartNavigationOperation(file, dartUnit)); 185 file)) {
186 } 186 server.addOperation(new _DartNavigationOperation(file, dartUnit));
187 if (server.hasAnalysisSubscription( 187 }
188 protocol.AnalysisService.OCCURRENCES, 188 if (server.hasAnalysisSubscription(
189 file)) { 189 protocol.AnalysisService.OCCURRENCES,
190 server.addOperation(new _DartOccurrencesOperation(file, dartUnit)); 190 file)) {
191 } 191 server.addOperation(new _DartOccurrencesOperation(file, dartUnit));
192 if (server.hasAnalysisSubscription( 192 }
193 protocol.AnalysisService.OUTLINE, 193 if (server.hasAnalysisSubscription(
194 file)) { 194 protocol.AnalysisService.OVERRIDES,
195 LineInfo lineInfo = notice.lineInfo; 195 file)) {
196 server.addOperation( 196 server.addOperation(new _DartOverridesOperation(file, dartUnit));
197 new _DartOutlineOperation(file, lineInfo, dartUnit)); 197 }
198 } 198 } else {
199 if (server.hasAnalysisSubscription( 199 if (server.hasAnalysisSubscription(
200 protocol.AnalysisService.OVERRIDES, 200 protocol.AnalysisService.OUTLINE,
201 file)) { 201 file)) {
202 server.addOperation(new _DartOverridesOperation(file, dartUnit)); 202 LineInfo lineInfo = notice.lineInfo;
203 server.addOperation(
204 new _DartOutlineOperation(file, lineInfo, dartUnit));
205 }
203 } 206 }
204 } 207 }
205 if (server.shouldSendErrorsNotificationFor(file)) { 208 if (server.shouldSendErrorsNotificationFor(file)) {
206 server.addOperation( 209 server.addOperation(
207 new _NotificationErrorsOperation(file, notice.lineInfo, notice.error s)); 210 new _NotificationErrorsOperation(file, notice.lineInfo, notice.error s));
208 } 211 }
209 server.fileAnalyzed(notice); 212 server.fileAnalyzed(notice);
210 } 213 }
211 } 214 }
212 215
213 void _setCacheSize(int cacheSize) { 216 void _setCacheSize(int cacheSize) {
214 AnalysisOptionsImpl options = 217 AnalysisOptionsImpl options =
215 new AnalysisOptionsImpl.con1(context.analysisOptions); 218 new AnalysisOptionsImpl.con1(context.analysisOptions);
216 options.cacheSize = cacheSize; 219 options.cacheSize = cacheSize;
217 context.analysisOptions = options; 220 context.analysisOptions = options;
218 } 221 }
219 222
220 void _updateIndex(AnalysisServer server, List<ChangeNotice> notices) { 223 void _updateIndex(AnalysisServer server, List<ChangeNotice> notices) {
221 Index index = server.index; 224 Index index = server.index;
222 if (index == null) { 225 if (index == null) {
223 return; 226 return;
224 } 227 }
225 for (ChangeNotice notice in notices) { 228 for (ChangeNotice notice in notices) {
226 // Dart 229 // Dart
227 try { 230 if (notice.resolved) {
228 CompilationUnit dartUnit = notice.compilationUnit; 231 try {
229 if (dartUnit != null) { 232 CompilationUnit dartUnit = notice.compilationUnit;
230 index.indexUnit(context, dartUnit); 233 if (dartUnit != null) {
234 index.indexUnit(context, dartUnit);
235 }
236 } catch (exception, stackTrace) {
237 server.sendServerErrorNotification(exception, stackTrace);
231 } 238 }
232 } catch (exception, stackTrace) { 239 // HTML
233 server.sendServerErrorNotification(exception, stackTrace); 240 try {
234 } 241 HtmlUnit htmlUnit = notice.htmlUnit;
235 // HTML 242 if (htmlUnit != null) {
236 try { 243 index.indexHtmlUnit(context, htmlUnit);
237 HtmlUnit htmlUnit = notice.htmlUnit; 244 }
238 if (htmlUnit != null) { 245 } catch (exception, stackTrace) {
239 index.indexHtmlUnit(context, htmlUnit); 246 server.sendServerErrorNotification(exception, stackTrace);
240 } 247 }
241 } catch (exception, stackTrace) {
242 server.sendServerErrorNotification(exception, stackTrace);
243 } 248 }
244 } 249 }
245 } 250 }
246 } 251 }
247 252
248 253
249 class _DartHighlightsOperation extends _DartNotificationOperation { 254 class _DartHighlightsOperation extends _DartNotificationOperation {
250 _DartHighlightsOperation(String file, CompilationUnit unit) 255 _DartHighlightsOperation(String file, CompilationUnit unit)
251 : super(file, unit); 256 : super(file, unit);
252 257
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
326 @override 331 @override
327 ServerOperationPriority get priority { 332 ServerOperationPriority get priority {
328 return ServerOperationPriority.ANALYSIS_NOTIFICATION; 333 return ServerOperationPriority.ANALYSIS_NOTIFICATION;
329 } 334 }
330 335
331 @override 336 @override
332 void perform(AnalysisServer server) { 337 void perform(AnalysisServer server) {
333 sendAnalysisNotificationErrors(server, file, lineInfo, errors); 338 sendAnalysisNotificationErrors(server, file, lineInfo, errors);
334 } 339 }
335 } 340 }
OLDNEW
« no previous file with comments | « pkg/analysis_server/lib/src/domain_execution.dart ('k') | pkg/analyzer/lib/src/generated/engine.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698