| 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_navigation.dart'; | 9 import 'package:analysis_server/src/computer/computer_navigation.dart'; |
| 10 import 'package:analysis_server/src/computer/computer_occurrences.dart'; | 10 import 'package:analysis_server/src/computer/computer_occurrences.dart'; |
| 11 import 'package:analysis_server/src/computer/computer_outline.dart'; | 11 import 'package:analysis_server/src/computer/computer_outline.dart'; |
| 12 import 'package:analysis_server/src/computer/computer_overrides.dart'; | 12 import 'package:analysis_server/src/computer/computer_overrides.dart'; |
| 13 import 'package:analysis_server/src/operation/operation.dart'; | 13 import 'package:analysis_server/src/operation/operation.dart'; |
| 14 import 'package:analysis_server/src/protocol_server.dart' as protocol; | 14 import 'package:analysis_server/src/protocol_server.dart' as protocol; |
| 15 import 'package:analysis_server/src/services/index/index.dart'; | 15 import 'package:analysis_server/src/services/index/index.dart'; |
| 16 import 'package:analyzer/src/generated/ast.dart'; | 16 import 'package:analyzer/src/generated/ast.dart'; |
| 17 import 'package:analyzer/src/generated/engine.dart'; | 17 import 'package:analyzer/src/generated/engine.dart'; |
| 18 import 'package:analyzer/src/generated/error.dart'; | 18 import 'package:analyzer/src/generated/error.dart'; |
| 19 import 'package:analyzer/src/generated/html.dart'; | 19 import 'package:analyzer/src/generated/html.dart'; |
| 20 import 'package:analyzer/src/generated/source.dart'; | 20 import 'package:analyzer/src/generated/source.dart'; |
| 21 | 21 |
| 22 /** | 22 /** |
| 23 * Schedules indexing of the given [file] using the resolved [dartUnit]. | 23 * Schedules indexing of the given [file] using the resolved [dartUnit]. |
| 24 */ | 24 */ |
| 25 void scheduleIndexOperation(AnalysisServer server, String file, | 25 void scheduleIndexOperation(AnalysisServer server, String file, |
| 26 AnalysisContext context, CompilationUnit dartUnit) { | 26 AnalysisContext context, CompilationUnit dartUnit) { |
| 27 server.addOperation(new _DartIndexOperation(context, file, dartUnit)); | 27 if (server.index != null) { |
| 28 server.addOperation(new _DartIndexOperation(context, file, dartUnit)); |
| 29 } |
| 28 } | 30 } |
| 29 | 31 |
| 30 /** | 32 /** |
| 31 * Schedules sending notifications for the given [file] using the resolved | 33 * Schedules sending notifications for the given [file] using the resolved |
| 32 * [resolvedDartUnit]. | 34 * [resolvedDartUnit]. |
| 33 */ | 35 */ |
| 34 void scheduleNotificationOperations(AnalysisServer server, String file, | 36 void scheduleNotificationOperations(AnalysisServer server, String file, |
| 35 LineInfo lineInfo, AnalysisContext context, CompilationUnit parsedDartUnit, | 37 LineInfo lineInfo, AnalysisContext context, CompilationUnit parsedDartUnit, |
| 36 CompilationUnit resolvedDartUnit, List<AnalysisError> errors) { | 38 CompilationUnit resolvedDartUnit, List<AnalysisError> errors) { |
| 37 // Dart | 39 // Dart |
| (...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 229 } | 231 } |
| 230 | 232 |
| 231 void _setCacheSize(int cacheSize) { | 233 void _setCacheSize(int cacheSize) { |
| 232 AnalysisOptionsImpl options = | 234 AnalysisOptionsImpl options = |
| 233 new AnalysisOptionsImpl.con1(context.analysisOptions); | 235 new AnalysisOptionsImpl.con1(context.analysisOptions); |
| 234 options.cacheSize = cacheSize; | 236 options.cacheSize = cacheSize; |
| 235 context.analysisOptions = options; | 237 context.analysisOptions = options; |
| 236 } | 238 } |
| 237 | 239 |
| 238 void _updateIndex(AnalysisServer server, List<ChangeNotice> notices) { | 240 void _updateIndex(AnalysisServer server, List<ChangeNotice> notices) { |
| 239 Index index = server.index; | 241 if (server.index == null) { |
| 240 if (index == null) { | |
| 241 return; | 242 return; |
| 242 } | 243 } |
| 243 for (ChangeNotice notice in notices) { | 244 for (ChangeNotice notice in notices) { |
| 244 String file = notice.source.fullName; | 245 String file = notice.source.fullName; |
| 245 // Dart | 246 // Dart |
| 246 try { | 247 try { |
| 247 CompilationUnit dartUnit = notice.resolvedDartUnit; | 248 CompilationUnit dartUnit = notice.resolvedDartUnit; |
| 248 if (dartUnit != null) { | 249 if (dartUnit != null) { |
| 249 server.addOperation(new _DartIndexOperation(context, file, dartUnit)); | 250 server.addOperation(new _DartIndexOperation(context, file, dartUnit)); |
| 250 } | 251 } |
| (...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 393 abstract class _SingleFileOperation extends SourceSensitiveOperation { | 394 abstract class _SingleFileOperation extends SourceSensitiveOperation { |
| 394 final String file; | 395 final String file; |
| 395 | 396 |
| 396 _SingleFileOperation(AnalysisContext context, this.file) : super(context); | 397 _SingleFileOperation(AnalysisContext context, this.file) : super(context); |
| 397 | 398 |
| 398 @override | 399 @override |
| 399 bool shouldBeDiscardedOnSourceChange(Source source) { | 400 bool shouldBeDiscardedOnSourceChange(Source source) { |
| 400 return source.fullName == file; | 401 return source.fullName == file; |
| 401 } | 402 } |
| 402 } | 403 } |
| OLD | NEW |