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 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_highlights2.dart'; | 9 import 'package:analysis_server/src/computer/computer_highlights2.dart'; |
10 import 'package:analysis_server/src/computer/computer_outline.dart'; | 10 import 'package:analysis_server/src/computer/computer_outline.dart'; |
11 import 'package:analysis_server/src/computer/computer_overrides.dart'; | 11 import 'package:analysis_server/src/computer/computer_overrides.dart'; |
12 import 'package:analysis_server/src/domains/analysis/implemented_dart.dart'; | 12 import 'package:analysis_server/src/domains/analysis/implemented_dart.dart'; |
13 import 'package:analysis_server/src/domains/analysis/navigation.dart'; | 13 import 'package:analysis_server/src/domains/analysis/navigation.dart'; |
14 import 'package:analysis_server/src/domains/analysis/occurrences.dart'; | 14 import 'package:analysis_server/src/domains/analysis/occurrences.dart'; |
15 import 'package:analysis_server/src/operation/operation.dart'; | 15 import 'package:analysis_server/src/operation/operation.dart'; |
16 import 'package:analysis_server/src/protocol_server.dart' as protocol; | 16 import 'package:analysis_server/src/protocol_server.dart' as protocol; |
17 import 'package:analysis_server/src/services/dependencies/library_dependencies.d
art'; | 17 import 'package:analysis_server/src/services/dependencies/library_dependencies.d
art'; |
18 import 'package:analysis_server/src/services/index/index.dart'; | |
19 import 'package:analysis_server/src/services/search/search_engine.dart'; | 18 import 'package:analysis_server/src/services/search/search_engine.dart'; |
20 import 'package:analyzer/dart/ast/ast.dart'; | 19 import 'package:analyzer/dart/ast/ast.dart'; |
21 import 'package:analyzer/dart/element/element.dart'; | 20 import 'package:analyzer/dart/element/element.dart'; |
22 import 'package:analyzer/src/generated/engine.dart'; | 21 import 'package:analyzer/src/generated/engine.dart'; |
23 import 'package:analyzer/src/generated/error.dart'; | 22 import 'package:analyzer/src/generated/error.dart'; |
24 import 'package:analyzer/src/generated/source.dart'; | 23 import 'package:analyzer/src/generated/source.dart'; |
25 | 24 |
26 /** | 25 /** |
27 * Runs the given function [f] with the working cache size in [context]. | 26 * Runs the given function [f] with the working cache size in [context]. |
28 * Returns the result of [f] invocation. | 27 * Returns the result of [f] invocation. |
(...skipping 420 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
449 | 448 |
450 @override | 449 @override |
451 ServerOperationPriority get priority { | 450 ServerOperationPriority get priority { |
452 return ServerOperationPriority.ANALYSIS_INDEX; | 451 return ServerOperationPriority.ANALYSIS_INDEX; |
453 } | 452 } |
454 | 453 |
455 @override | 454 @override |
456 void perform(AnalysisServer server) { | 455 void perform(AnalysisServer server) { |
457 ServerPerformanceStatistics.indexOperation.makeCurrentWhile(() { | 456 ServerPerformanceStatistics.indexOperation.makeCurrentWhile(() { |
458 try { | 457 try { |
459 Index index = server.index; | 458 server.index?.indexUnit(unit); |
460 AnalysisContext context = unit.element.context; | |
461 index.index(context, unit); | |
462 server.index2?.indexUnit(unit); | |
463 } catch (exception, stackTrace) { | 459 } catch (exception, stackTrace) { |
464 server.sendServerErrorNotification( | 460 server.sendServerErrorNotification( |
465 'Failed to index: $file', exception, stackTrace); | 461 'Failed to index: $file', exception, stackTrace); |
466 } | 462 } |
467 }); | 463 }); |
468 } | 464 } |
469 } | 465 } |
470 | 466 |
471 abstract class _DartNotificationOperation extends _SingleFileOperation { | 467 abstract class _DartNotificationOperation extends _SingleFileOperation { |
472 final CompilationUnit unit; | 468 final CompilationUnit unit; |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
543 abstract class _SingleFileOperation extends SourceSensitiveOperation { | 539 abstract class _SingleFileOperation extends SourceSensitiveOperation { |
544 final String file; | 540 final String file; |
545 | 541 |
546 _SingleFileOperation(AnalysisContext context, this.file) : super(context); | 542 _SingleFileOperation(AnalysisContext context, this.file) : super(context); |
547 | 543 |
548 @override | 544 @override |
549 bool shouldBeDiscardedOnSourceChange(Source source) { | 545 bool shouldBeDiscardedOnSourceChange(Source source) { |
550 return source.fullName == file; | 546 return source.fullName == file; |
551 } | 547 } |
552 } | 548 } |
OLD | NEW |