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 import 'dart:async'; |
| 6 |
5 import 'package:analysis_server/src/analysis_server.dart'; | 7 import 'package:analysis_server/src/analysis_server.dart'; |
6 import 'package:analysis_server/src/computer/computer_highlights.dart'; | 8 import 'package:analysis_server/src/computer/computer_highlights.dart'; |
7 import 'package:analysis_server/src/computer/computer_highlights2.dart'; | 9 import 'package:analysis_server/src/computer/computer_highlights2.dart'; |
8 import 'package:analysis_server/src/computer/computer_outline.dart'; | 10 import 'package:analysis_server/src/computer/computer_outline.dart'; |
9 import 'package:analysis_server/src/computer/computer_overrides.dart'; | 11 import 'package:analysis_server/src/computer/computer_overrides.dart'; |
10 import 'package:analysis_server/src/domains/analysis/implemented_dart.dart'; | 12 import 'package:analysis_server/src/domains/analysis/implemented_dart.dart'; |
11 import 'package:analysis_server/src/domains/analysis/navigation.dart'; | 13 import 'package:analysis_server/src/domains/analysis/navigation.dart'; |
12 import 'package:analysis_server/src/domains/analysis/occurrences.dart'; | 14 import 'package:analysis_server/src/domains/analysis/occurrences.dart'; |
13 import 'package:analysis_server/src/operation/operation.dart'; | 15 import 'package:analysis_server/src/operation/operation.dart'; |
14 import 'package:analysis_server/src/protocol_server.dart' as protocol; | 16 import 'package:analysis_server/src/protocol_server.dart' as protocol; |
(...skipping 16 matching lines...) Expand all Loading... |
31 try { | 33 try { |
32 return f(); | 34 return f(); |
33 } finally { | 35 } finally { |
34 context.isActive = false; | 36 context.isActive = false; |
35 } | 37 } |
36 } else { | 38 } else { |
37 return f(); | 39 return f(); |
38 } | 40 } |
39 } | 41 } |
40 | 42 |
41 scheduleImplementedNotification( | 43 Future<Null> scheduleImplementedNotification( |
42 AnalysisServer server, Iterable<String> files) async { | 44 AnalysisServer server, Iterable<String> files) async { |
43 SearchEngine searchEngine = server.searchEngine; | 45 SearchEngine searchEngine = server.searchEngine; |
44 if (searchEngine == null) { | 46 if (searchEngine == null) { |
45 return; | 47 return; |
46 } | 48 } |
47 for (String file in files) { | 49 for (String file in files) { |
48 CompilationUnitElement unitElement = server.getCompilationUnitElement(file); | 50 CompilationUnit unit = await server.getResolvedCompilationUnit(file); |
| 51 CompilationUnitElement unitElement = unit?.element; |
49 if (unitElement != null) { | 52 if (unitElement != null) { |
50 try { | 53 try { |
51 ImplementedComputer computer = | 54 ImplementedComputer computer = |
52 new ImplementedComputer(searchEngine, unitElement); | 55 new ImplementedComputer(searchEngine, unitElement); |
53 await computer.compute(); | 56 await computer.compute(); |
54 var params = new protocol.AnalysisImplementedParams( | 57 var params = new protocol.AnalysisImplementedParams( |
55 file, computer.classes, computer.members); | 58 file, computer.classes, computer.members); |
56 server.sendNotification(params.toNotification()); | 59 server.sendNotification(params.toNotification()); |
57 } catch (exception, stackTrace) { | 60 } catch (exception, stackTrace) { |
58 server.sendServerErrorNotification( | 61 server.sendServerErrorNotification( |
(...skipping 482 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
541 abstract class _SingleFileOperation extends SourceSensitiveOperation { | 544 abstract class _SingleFileOperation extends SourceSensitiveOperation { |
542 final String file; | 545 final String file; |
543 | 546 |
544 _SingleFileOperation(AnalysisContext context, this.file) : super(context); | 547 _SingleFileOperation(AnalysisContext context, this.file) : super(context); |
545 | 548 |
546 @override | 549 @override |
547 bool shouldBeDiscardedOnSourceChange(Source source) { | 550 bool shouldBeDiscardedOnSourceChange(Source source) { |
548 return source.fullName == file; | 551 return source.fullName == file; |
549 } | 552 } |
550 } | 553 } |
OLD | NEW |