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'; |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
129 } | 129 } |
130 analysisFuture.then((AnalysisDoneReason reason) { | 130 analysisFuture.then((AnalysisDoneReason reason) { |
131 switch (reason) { | 131 switch (reason) { |
132 case AnalysisDoneReason.COMPLETE: | 132 case AnalysisDoneReason.COMPLETE: |
133 List<CompilationUnit> units = | 133 List<CompilationUnit> units = |
134 server.getResolvedCompilationUnits(file); | 134 server.getResolvedCompilationUnits(file); |
135 if (units.isEmpty) { | 135 if (units.isEmpty) { |
136 server.sendResponse(new Response.getNavigationInvalidFile(request)); | 136 server.sendResponse(new Response.getNavigationInvalidFile(request)); |
137 } else { | 137 } else { |
138 CompilationUnitElement unitElement = units.first.element; | 138 CompilationUnitElement unitElement = units.first.element; |
139 NavigationHolderImpl holder = computeNavigation( | 139 NavigationCollectorImpl collector = computeNavigation( |
140 server, | 140 server, |
141 unitElement.context, | 141 unitElement.context, |
142 unitElement.source, | 142 unitElement.source, |
143 params.offset, | 143 params.offset, |
144 params.length); | 144 params.length); |
145 server.sendResponse(new AnalysisGetNavigationResult( | 145 server.sendResponse(new AnalysisGetNavigationResult( |
146 holder.files, holder.targets, holder.regions) | 146 collector.files, collector.targets, collector.regions) |
147 .toResponse(request.id)); | 147 .toResponse(request.id)); |
148 } | 148 } |
149 break; | 149 break; |
150 case AnalysisDoneReason.CONTEXT_REMOVED: | 150 case AnalysisDoneReason.CONTEXT_REMOVED: |
151 // The active contexts have changed, so try again. | 151 // The active contexts have changed, so try again. |
152 Response response = getNavigation(request); | 152 Response response = getNavigation(request); |
153 if (response != Response.DELAYED_RESPONSE) { | 153 if (response != Response.DELAYED_RESPONSE) { |
154 server.sendResponse(response); | 154 server.sendResponse(response); |
155 } | 155 } |
156 break; | 156 break; |
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
360 context.onResultComputed(descriptor).listen((result) { | 360 context.onResultComputed(descriptor).listen((result) { |
361 StreamController<engine.ComputedResult> controller = | 361 StreamController<engine.ComputedResult> controller = |
362 controllers[result.descriptor]; | 362 controllers[result.descriptor]; |
363 if (controller != null) { | 363 if (controller != null) { |
364 controller.add(result); | 364 controller.add(result); |
365 } | 365 } |
366 }); | 366 }); |
367 } | 367 } |
368 } | 368 } |
369 } | 369 } |
OLD | NEW |