OLD | NEW |
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, 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 src.services.index; | 5 library src.services.index; |
6 | 6 |
7 import 'dart:collection'; | 7 import 'dart:collection'; |
8 | 8 |
9 import 'package:analysis_server/plugin/index/index_core.dart'; | 9 import 'package:analysis_server/plugin/index/index_core.dart'; |
10 import 'package:analyzer/src/generated/element.dart'; | 10 import 'package:analyzer/src/generated/element.dart'; |
(...skipping 27 matching lines...) Expand all Loading... |
38 | 38 |
39 @override | 39 @override |
40 int get offset { | 40 int get offset { |
41 if (element is ConstructorElement) { | 41 if (element is ConstructorElement) { |
42 return element.enclosingElement.nameOffset; | 42 return element.enclosingElement.nameOffset; |
43 } | 43 } |
44 return element.nameOffset; | 44 return element.nameOffset; |
45 } | 45 } |
46 | 46 |
47 @override | 47 @override |
48 Source get source => element.source; | 48 String get filePath { |
| 49 return element.source?.fullName; |
| 50 } |
49 | 51 |
50 @override | 52 @override |
51 bool operator ==(Object object) => | 53 bool operator ==(Object object) => |
52 object is IndexableElement && element == object.element; | 54 object is IndexableElement && element == object.element; |
53 | 55 |
54 @override | 56 @override |
55 String toString() => element.toString(); | 57 String toString() => element.toString(); |
56 } | 58 } |
57 | 59 |
58 /** | 60 /** |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
164 ClassElement classElement = element.enclosingElement; | 166 ClassElement classElement = element.enclosingElement; |
165 int constructorIndex = classElement.constructors.indexOf(element); | 167 int constructorIndex = classElement.constructors.indexOf(element); |
166 return _constructorKinds.putIfAbsent(constructorIndex, | 168 return _constructorKinds.putIfAbsent(constructorIndex, |
167 () => new IndexableElementKind._(ElementKind.CONSTRUCTOR)); | 169 () => new IndexableElementKind._(ElementKind.CONSTRUCTOR)); |
168 } | 170 } |
169 ElementKind elementKind = element.kind; | 171 ElementKind elementKind = element.kind; |
170 return _kindMap.putIfAbsent( | 172 return _kindMap.putIfAbsent( |
171 elementKind, () => new IndexableElementKind._(elementKind)); | 173 elementKind, () => new IndexableElementKind._(elementKind)); |
172 } | 174 } |
173 } | 175 } |
OLD | NEW |