Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(487)

Side by Side Diff: pkg/analysis_server/lib/src/services/index/indexable_element.dart

Issue 1372673003: Use Element.nameLength where possible. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/analysis/index_core.dart'; 9 import 'package:analysis_server/analysis/index_core.dart';
10 import 'package:analyzer/src/generated/element.dart'; 10 import 'package:analyzer/src/generated/element.dart';
(...skipping 18 matching lines...) Expand all
29 } 29 }
30 } 30 }
31 31
32 @override 32 @override
33 int get hashCode => element.hashCode; 33 int get hashCode => element.hashCode;
34 34
35 @override 35 @override
36 IndexableObjectKind get kind => IndexableElementKind.forElement(element); 36 IndexableObjectKind get kind => IndexableElementKind.forElement(element);
37 37
38 @override 38 @override
39 int get length => element.displayName.length; 39 int get length => element.nameLength;
40 40
41 @override 41 @override
42 String get name => element.displayName; 42 String get name => element.displayName;
43 43
44 @override 44 @override
45 int get offset { 45 int get offset {
46 if (element is ConstructorElement) { 46 if (element is ConstructorElement) {
47 return element.enclosingElement.nameOffset; 47 return element.enclosingElement.nameOffset;
48 } 48 }
49 return element.nameOffset; 49 return element.nameOffset;
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
153 ClassElement classElement = element.enclosingElement; 153 ClassElement classElement = element.enclosingElement;
154 int constructorIndex = classElement.constructors.indexOf(element); 154 int constructorIndex = classElement.constructors.indexOf(element);
155 return _constructorKinds.putIfAbsent(constructorIndex, 155 return _constructorKinds.putIfAbsent(constructorIndex,
156 () => new IndexableElementKind._(ElementKind.CONSTRUCTOR)); 156 () => new IndexableElementKind._(ElementKind.CONSTRUCTOR));
157 } 157 }
158 ElementKind elementKind = element.kind; 158 ElementKind elementKind = element.kind;
159 return _kindMap.putIfAbsent( 159 return _kindMap.putIfAbsent(
160 elementKind, () => new IndexableElementKind._(elementKind)); 160 elementKind, () => new IndexableElementKind._(elementKind));
161 } 161 }
162 } 162 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698