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 domain.analysis; | 5 library domain.analysis; |
6 | 6 |
7 import 'dart:async'; | 7 import 'dart:async'; |
8 import 'dart:core' hide Resource; | 8 import 'dart:core' hide Resource; |
9 | 9 |
10 import 'package:analysis_server/analysis/analysis_domain.dart'; | 10 import 'package:analysis_server/analysis/analysis_domain.dart'; |
11 import 'package:analysis_server/src/analysis_server.dart'; | 11 import 'package:analysis_server/src/analysis_server.dart'; |
12 import 'package:analysis_server/src/computer/computer_hover.dart'; | 12 import 'package:analysis_server/src/computer/computer_hover.dart'; |
13 import 'package:analysis_server/src/constants.dart'; | 13 import 'package:analysis_server/src/constants.dart'; |
14 import 'package:analysis_server/src/context_manager.dart'; | 14 import 'package:analysis_server/src/context_manager.dart'; |
15 import 'package:analysis_server/src/domains/analysis/navigation.dart'; | 15 import 'package:analysis_server/src/domains/analysis/navigation.dart'; |
16 import 'package:analysis_server/src/operation/operation_analysis.dart' | 16 import 'package:analysis_server/src/operation/operation_analysis.dart' |
17 show sendAnalysisNotificationNavigation; | 17 show NavigationOperation, sendAnalysisNotificationNavigation; |
18 import 'package:analysis_server/src/protocol_server.dart'; | 18 import 'package:analysis_server/src/protocol_server.dart'; |
19 import 'package:analysis_server/src/services/dependencies/library_dependencies.d
art'; | 19 import 'package:analysis_server/src/services/dependencies/library_dependencies.d
art'; |
20 import 'package:analyzer/file_system/file_system.dart'; | 20 import 'package:analyzer/file_system/file_system.dart'; |
21 import 'package:analyzer/src/generated/ast.dart'; | 21 import 'package:analyzer/src/generated/ast.dart'; |
22 import 'package:analyzer/src/generated/element.dart'; | 22 import 'package:analyzer/src/generated/element.dart'; |
23 import 'package:analyzer/src/generated/engine.dart' as engine; | 23 import 'package:analyzer/src/generated/engine.dart' as engine; |
24 import 'package:analyzer/src/generated/java_engine.dart' show CaughtException; | 24 import 'package:analyzer/src/generated/java_engine.dart' show CaughtException; |
25 import 'package:analyzer/src/generated/source.dart'; | 25 import 'package:analyzer/src/generated/source.dart'; |
26 import 'package:analyzer/task/model.dart' show ResultDescriptor; | 26 import 'package:analyzer/task/model.dart' show ResultDescriptor; |
27 | 27 |
(...skipping 312 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
340 .putIfAbsent(descriptor, | 340 .putIfAbsent(descriptor, |
341 () => new StreamController<engine.ComputedResult>.broadcast()) | 341 () => new StreamController<engine.ComputedResult>.broadcast()) |
342 .stream; | 342 .stream; |
343 server.getAnalysisContexts().forEach(_subscribeForContext); | 343 server.getAnalysisContexts().forEach(_subscribeForContext); |
344 return stream; | 344 return stream; |
345 } | 345 } |
346 | 346 |
347 @override | 347 @override |
348 void scheduleNotification( | 348 void scheduleNotification( |
349 engine.AnalysisContext context, Source source, AnalysisService service) { | 349 engine.AnalysisContext context, Source source, AnalysisService service) { |
350 // TODO(scheglov) schedule, don't do it right now | |
351 String file = source.fullName; | 350 String file = source.fullName; |
352 if (server.hasAnalysisSubscription(service, file)) { | 351 if (server.hasAnalysisSubscription(service, file)) { |
353 if (service == AnalysisService.NAVIGATION) { | 352 if (service == AnalysisService.NAVIGATION) { |
354 sendAnalysisNotificationNavigation(server, context, source); | 353 server.scheduleOperation(new NavigationOperation(context, source)); |
355 } | 354 } |
356 } | 355 } |
357 } | 356 } |
358 | 357 |
359 void _subscribeForContext(engine.AnalysisContext context) { | 358 void _subscribeForContext(engine.AnalysisContext context) { |
360 for (ResultDescriptor descriptor in controllers.keys) { | 359 for (ResultDescriptor descriptor in controllers.keys) { |
361 context.onResultComputed(descriptor).listen((result) { | 360 context.onResultComputed(descriptor).listen((result) { |
362 StreamController<engine.ComputedResult> controller = | 361 StreamController<engine.ComputedResult> controller = |
363 controllers[result.descriptor]; | 362 controllers[result.descriptor]; |
364 if (controller != null) { | 363 if (controller != null) { |
365 controller.add(result); | 364 controller.add(result); |
366 } | 365 } |
367 }); | 366 }); |
368 } | 367 } |
369 } | 368 } |
370 } | 369 } |
OLD | NEW |