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

Side by Side Diff: pkg/analysis_server/lib/src/domain_analysis.dart

Issue 2949103003: Remove more dead code from analysis server (Closed)
Patch Set: Created 3 years, 6 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
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 import 'dart:async'; 5 import 'dart:async';
6 import 'dart:core'; 6 import 'dart:core';
7 7
8 import 'package:analysis_server/plugin/analysis/analysis_domain.dart'; 8 import 'package:analysis_server/plugin/analysis/analysis_domain.dart';
9 import 'package:analysis_server/src/analysis_server.dart'; 9 import 'package:analysis_server/src/analysis_server.dart';
10 import 'package:analysis_server/src/computer/computer_hover.dart'; 10 import 'package:analysis_server/src/computer/computer_hover.dart';
11 import 'package:analysis_server/src/constants.dart'; 11 import 'package:analysis_server/src/constants.dart';
12 import 'package:analysis_server/src/context_manager.dart'; 12 import 'package:analysis_server/src/context_manager.dart';
13 import 'package:analysis_server/src/domain_abstract.dart'; 13 import 'package:analysis_server/src/domain_abstract.dart';
14 import 'package:analysis_server/src/domains/analysis/navigation.dart'; 14 import 'package:analysis_server/src/domains/analysis/navigation.dart';
15 import 'package:analysis_server/src/domains/analysis/navigation_dart.dart'; 15 import 'package:analysis_server/src/domains/analysis/navigation_dart.dart';
16 import 'package:analysis_server/src/operation/operation_analysis.dart' 16 import 'package:analysis_server/src/operation/operation_analysis.dart'
17 show NavigationOperation, OccurrencesOperation; 17 show NavigationOperation, OccurrencesOperation;
18 import 'package:analysis_server/src/plugin/plugin_manager.dart'; 18 import 'package:analysis_server/src/plugin/plugin_manager.dart';
19 import 'package:analysis_server/src/plugin/request_converter.dart'; 19 import 'package:analysis_server/src/plugin/request_converter.dart';
20 import 'package:analysis_server/src/plugin/result_merger.dart'; 20 import 'package:analysis_server/src/plugin/result_merger.dart';
21 import 'package:analysis_server/src/protocol/protocol_internal.dart'; 21 import 'package:analysis_server/src/protocol/protocol_internal.dart';
22 import 'package:analysis_server/src/protocol_server.dart'; 22 import 'package:analysis_server/src/protocol_server.dart';
23 import 'package:analysis_server/src/services/dependencies/library_dependencies.d art';
24 import 'package:analyzer/dart/ast/ast.dart'; 23 import 'package:analyzer/dart/ast/ast.dart';
25 import 'package:analyzer/error/error.dart' as engine; 24 import 'package:analyzer/error/error.dart' as engine;
26 import 'package:analyzer/exception/exception.dart'; 25 import 'package:analyzer/exception/exception.dart';
27 import 'package:analyzer/file_system/file_system.dart'; 26 import 'package:analyzer/file_system/file_system.dart';
28 import 'package:analyzer/src/dart/analysis/driver.dart'; 27 import 'package:analyzer/src/dart/analysis/driver.dart';
29 import 'package:analyzer/src/generated/engine.dart' as engine; 28 import 'package:analyzer/src/generated/engine.dart' as engine;
30 import 'package:analyzer/src/generated/source.dart'; 29 import 'package:analyzer/src/generated/source.dart';
31 import 'package:analyzer/task/model.dart' show ResultDescriptor; 30 import 'package:analyzer/task/model.dart' show ResultDescriptor;
32 import 'package:analyzer_plugin/protocol/protocol.dart' as plugin; 31 import 'package:analyzer_plugin/protocol/protocol.dart' as plugin;
33 import 'package:analyzer_plugin/protocol/protocol_common.dart'; 32 import 'package:analyzer_plugin/protocol/protocol_common.dart';
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
96 if (hoverInformation != null) { 95 if (hoverInformation != null) {
97 hovers.add(hoverInformation); 96 hovers.add(hoverInformation);
98 } 97 }
99 } 98 }
100 99
101 // Send the response. 100 // Send the response.
102 server.sendResponse( 101 server.sendResponse(
103 new AnalysisGetHoverResult(hovers).toResponse(request.id)); 102 new AnalysisGetHoverResult(hovers).toResponse(request.id));
104 } 103 }
105 104
106 /// Implement the `analysis.getLibraryDependencies` request. 105 /**
106 * Implement the `analysis.getLibraryDependencies` request.
107 */
107 Response getLibraryDependencies(Request request) { 108 Response getLibraryDependencies(Request request) {
108 server.onAnalysisComplete.then((_) { 109 return new Response.unsupportedFeature(request.id,
109 LibraryDependencyCollector collector = 110 'Please contact the Dart analyzer team if you need this request.');
110 new LibraryDependencyCollector(server.analysisContexts); 111 // server.onAnalysisComplete.then((_) {
111 Set<String> libraries = collector.collectLibraryDependencies(); 112 // LibraryDependencyCollector collector =
112 Map<String, Map<String, List<String>>> packageMap = 113 // new LibraryDependencyCollector(server.analysisContexts);
113 collector.calculatePackageMap(server.folderMap); 114 // Set<String> libraries = collector.collectLibraryDependencies();
114 server.sendResponse(new AnalysisGetLibraryDependenciesResult( 115 // Map<String, Map<String, List<String>>> packageMap =
115 libraries.toList(growable: false), packageMap) 116 // collector.calculatePackageMap(server.folderMap);
116 .toResponse(request.id)); 117 // server.sendResponse(new AnalysisGetLibraryDependenciesResult(
117 }).catchError((error, st) { 118 // libraries.toList(growable: false), packageMap)
118 server.sendResponse(new Response.serverError(request, error, st)); 119 // .toResponse(request.id));
119 }); 120 // }).catchError((error, st) {
120 // delay response 121 // server.sendResponse(new Response.serverError(request, error, st));
121 return Response.DELAYED_RESPONSE; 122 // });
123 // // delay response
124 // return Response.DELAYED_RESPONSE;
122 } 125 }
123 126
124 /** 127 /**
125 * Implement the `analysis.getNavigation` request. 128 * Implement the `analysis.getNavigation` request.
126 */ 129 */
127 Future<Null> getNavigation(Request request) async { 130 Future<Null> getNavigation(Request request) async {
128 var params = new AnalysisGetNavigationParams.fromRequest(request); 131 var params = new AnalysisGetNavigationParams.fromRequest(request);
129 String file = params.file; 132 String file = params.file;
130 int offset = params.offset; 133 int offset = params.offset;
131 int length = params.length; 134 int length = params.length;
(...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after
422 * An implementation of [AnalysisDomain] for [AnalysisServer]. 425 * An implementation of [AnalysisDomain] for [AnalysisServer].
423 */ 426 */
424 class AnalysisDomainImpl implements AnalysisDomain { 427 class AnalysisDomainImpl implements AnalysisDomain {
425 final AnalysisServer server; 428 final AnalysisServer server;
426 429
427 final Map<ResultDescriptor, StreamController<engine.ResultChangedEvent>> 430 final Map<ResultDescriptor, StreamController<engine.ResultChangedEvent>>
428 controllers = 431 controllers =
429 <ResultDescriptor, StreamController<engine.ResultChangedEvent>>{}; 432 <ResultDescriptor, StreamController<engine.ResultChangedEvent>>{};
430 433
431 AnalysisDomainImpl(this.server) { 434 AnalysisDomainImpl(this.server) {
432 server.onContextsChanged.listen((ContextsChangedEvent event) { 435 // TODO(brianwilkerson) The onContextsChanged stream is no longer written to .
433 event.added.forEach(_subscribeForContext); 436 // Figure out whether this code still needs to be here and convert it to use
434 }); 437 // the analysis driver if it does.
438 // server.onContextsChanged.listen((ContextsChangedEvent event) {
439 // event.added.forEach(_subscribeForContext);
440 // });
435 } 441 }
436 442
437 @override 443 @override
438 Stream<engine.ResultChangedEvent> onResultChanged(
439 ResultDescriptor descriptor) {
440 Stream<engine.ResultChangedEvent> stream =
441 controllers.putIfAbsent(descriptor, () {
442 return new StreamController<engine.ResultChangedEvent>.broadcast();
443 }).stream;
444 server.analysisContexts.forEach(_subscribeForContext);
445 return stream;
446 }
447
448 @override
449 void scheduleNotification( 444 void scheduleNotification(
450 engine.AnalysisContext context, Source source, AnalysisService service) { 445 engine.AnalysisContext context, Source source, AnalysisService service) {
451 String file = source.fullName; 446 String file = source.fullName;
452 if (server.hasAnalysisSubscription(service, file)) { 447 if (server.hasAnalysisSubscription(service, file)) {
453 if (service == AnalysisService.NAVIGATION) { 448 if (service == AnalysisService.NAVIGATION) {
454 server.scheduleOperation(new NavigationOperation(context, source)); 449 server.scheduleOperation(new NavigationOperation(context, source));
455 } 450 }
456 if (service == AnalysisService.OCCURRENCES) { 451 if (service == AnalysisService.OCCURRENCES) {
457 server.scheduleOperation(new OccurrencesOperation(context, source)); 452 server.scheduleOperation(new OccurrencesOperation(context, source));
458 } 453 }
459 } 454 }
460 } 455 }
461 456
462 void _subscribeForContext(engine.AnalysisContext context) { 457 void _subscribeForContext(engine.AnalysisContext context) {
scheglov 2017/06/26 15:49:45 IIRC, this was implemented for in-process Angular
Brian Wilkerson 2017/06/26 16:27:54 Yep. It was deleted in a later CL.
463 for (ResultDescriptor descriptor in controllers.keys) { 458 for (ResultDescriptor descriptor in controllers.keys) {
464 context.onResultChanged(descriptor).listen((result) { 459 context.onResultChanged(descriptor).listen((result) {
465 StreamController<engine.ResultChangedEvent> controller = 460 StreamController<engine.ResultChangedEvent> controller =
466 controllers[result.descriptor]; 461 controllers[result.descriptor];
467 if (controller != null) { 462 if (controller != null) {
468 controller.add(result); 463 controller.add(result);
469 } 464 }
470 }); 465 });
471 } 466 }
472 } 467 }
473 } 468 }
OLDNEW
« no previous file with comments | « pkg/analysis_server/lib/src/context_manager.dart ('k') | pkg/analysis_server/lib/src/operation/operation_analysis.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698