OLD | NEW |
1 // Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2017, 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 'package:analyzer/dart/analysis/results.dart'; | 5 import 'package:analyzer/dart/analysis/results.dart'; |
6 import 'package:analyzer/file_system/file_system.dart'; | 6 import 'package:analyzer/file_system/file_system.dart'; |
7 import 'package:analyzer/src/generated/source.dart' show SourceRange; | 7 import 'package:analyzer/src/generated/source.dart' show SourceRange; |
8 import 'package:analyzer_plugin/protocol/protocol_common.dart'; | 8 import 'package:analyzer_plugin/protocol/protocol_common.dart'; |
9 import 'package:analyzer_plugin/utilities/navigation/navigation.dart'; | 9 import 'package:analyzer_plugin/utilities/navigation/navigation.dart'; |
10 import 'package:analyzer_plugin/utilities/pair.dart'; | 10 import 'package:analyzer_plugin/utilities/pair.dart'; |
11 | 11 |
12 /** | 12 /** |
| 13 * A concrete implementation of [DartNavigationRequest]. |
| 14 */ |
| 15 class DartNavigationRequestImpl implements DartNavigationRequest { |
| 16 @override |
| 17 final ResourceProvider resourceProvider; |
| 18 |
| 19 @override |
| 20 final int length; |
| 21 |
| 22 @override |
| 23 final int offset; |
| 24 |
| 25 @override |
| 26 final ResolveResult result; |
| 27 |
| 28 /** |
| 29 * Initialize a newly create request with the given data. |
| 30 */ |
| 31 DartNavigationRequestImpl( |
| 32 this.resourceProvider, this.offset, this.length, this.result); |
| 33 |
| 34 @override |
| 35 String get path => result.path; |
| 36 } |
| 37 |
| 38 /** |
13 * A concrete implementation of [NavigationCollector]. | 39 * A concrete implementation of [NavigationCollector]. |
14 */ | 40 */ |
15 class NavigationCollectorImpl implements NavigationCollector { | 41 class NavigationCollectorImpl implements NavigationCollector { |
16 /** | 42 /** |
17 * A list of navigation regions. | 43 * A list of navigation regions. |
18 */ | 44 */ |
19 final List<NavigationRegion> regions = <NavigationRegion>[]; | 45 final List<NavigationRegion> regions = <NavigationRegion>[]; |
20 final Map<SourceRange, List<int>> regionMap = <SourceRange, List<int>>{}; | 46 final Map<SourceRange, List<int>> regionMap = <SourceRange, List<int>>{}; |
21 | 47 |
22 /** | 48 /** |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
76 location.offset, | 102 location.offset, |
77 location.length, | 103 location.length, |
78 location.startLine, | 104 location.startLine, |
79 location.startColumn); | 105 location.startColumn); |
80 targets.add(target); | 106 targets.add(target); |
81 targetMap[pair] = index; | 107 targetMap[pair] = index; |
82 } | 108 } |
83 return index; | 109 return index; |
84 } | 110 } |
85 } | 111 } |
86 | |
87 /** | |
88 * A concrete implementation of [NavigationRequest]. | |
89 */ | |
90 class NavigationRequestImpl implements NavigationRequest { | |
91 @override | |
92 final ResourceProvider resourceProvider; | |
93 | |
94 @override | |
95 final int length; | |
96 | |
97 @override | |
98 final int offset; | |
99 | |
100 @override | |
101 final ResolveResult result; | |
102 | |
103 /** | |
104 * Initialize a newly create request with the given data. | |
105 */ | |
106 NavigationRequestImpl( | |
107 this.resourceProvider, this.offset, this.length, this.result); | |
108 } | |
OLD | NEW |