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/search/search_engine.dart'; | 18 import 'package:analysis_server/src/services/search/search_engine.dart'; |
19 import 'package:analyzer/dart/ast/ast.dart'; | 19 import 'package:analyzer/dart/ast/ast.dart'; |
| 20 import 'package:analyzer/dart/ast/standard_resolution_map.dart'; |
20 import 'package:analyzer/dart/element/element.dart'; | 21 import 'package:analyzer/dart/element/element.dart'; |
21 import 'package:analyzer/error/error.dart'; | 22 import 'package:analyzer/error/error.dart'; |
22 import 'package:analyzer/src/generated/engine.dart'; | 23 import 'package:analyzer/src/generated/engine.dart'; |
23 import 'package:analyzer/src/generated/source.dart'; | 24 import 'package:analyzer/src/generated/source.dart'; |
24 | 25 |
25 /** | 26 /** |
26 * Run the given function [f] with the given [context] made active. | 27 * Run the given function [f] with the given [context] made active. |
27 * Return the result of [f] invocation. | 28 * Return the result of [f] invocation. |
28 */ | 29 */ |
29 runWithActiveContext(AnalysisContext context, f()) { | 30 runWithActiveContext(AnalysisContext context, f()) { |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
64 } | 65 } |
65 } | 66 } |
66 } | 67 } |
67 | 68 |
68 /** | 69 /** |
69 * Schedules indexing of the given [file] using the resolved [dartUnit]. | 70 * Schedules indexing of the given [file] using the resolved [dartUnit]. |
70 */ | 71 */ |
71 void scheduleIndexOperation( | 72 void scheduleIndexOperation( |
72 AnalysisServer server, String file, CompilationUnit dartUnit) { | 73 AnalysisServer server, String file, CompilationUnit dartUnit) { |
73 if (server.index != null) { | 74 if (server.index != null) { |
74 AnalysisContext context = dartUnit.element.context; | 75 AnalysisContext context = |
| 76 resolutionMap.elementForCompilationUnit(dartUnit).context; |
75 server.addOperation(new _DartIndexOperation(context, file, dartUnit)); | 77 server.addOperation(new _DartIndexOperation(context, file, dartUnit)); |
76 } | 78 } |
77 } | 79 } |
78 | 80 |
79 /** | 81 /** |
80 * Schedules sending notifications for the given [file] using the resolved | 82 * Schedules sending notifications for the given [file] using the resolved |
81 * [resolvedDartUnit]. | 83 * [resolvedDartUnit]. |
82 */ | 84 */ |
83 void scheduleNotificationOperations( | 85 void scheduleNotificationOperations( |
84 AnalysisServer server, | 86 AnalysisServer server, |
(...skipping 451 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
536 abstract class _SingleFileOperation extends SourceSensitiveOperation { | 538 abstract class _SingleFileOperation extends SourceSensitiveOperation { |
537 final String file; | 539 final String file; |
538 | 540 |
539 _SingleFileOperation(AnalysisContext context, this.file) : super(context); | 541 _SingleFileOperation(AnalysisContext context, this.file) : super(context); |
540 | 542 |
541 @override | 543 @override |
542 bool shouldBeDiscardedOnSourceChange(Source source) { | 544 bool shouldBeDiscardedOnSourceChange(Source source) { |
543 return source.fullName == file; | 545 return source.fullName == file; |
544 } | 546 } |
545 } | 547 } |
OLD | NEW |