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

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

Issue 1378843003: Remove the 'name' and 'length' getters from IndexableObject. (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) 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 services.index; 5 library services.index;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 8
9 import 'package:analysis_server/analysis/index_core.dart'; 9 import 'package:analysis_server/analysis/index_core.dart';
10 import 'package:analysis_server/src/services/index/indexable_element.dart'; 10 import 'package:analysis_server/src/services/index/indexable_element.dart';
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 75
76 /** 76 /**
77 * Initialize a newly created indexable name to represent the given [name]. 77 * Initialize a newly created indexable name to represent the given [name].
78 */ 78 */
79 IndexableName(this.name); 79 IndexableName(this.name);
80 80
81 @override 81 @override
82 IndexableObjectKind get kind => IndexableNameKind.INSTANCE; 82 IndexableObjectKind get kind => IndexableNameKind.INSTANCE;
83 83
84 @override 84 @override
85 int get length => 0;
86
87 @override
88 int get offset { 85 int get offset {
89 return -1; 86 return -1;
90 } 87 }
91 88
92 @override 89 @override
93 Source get source => null; 90 Source get source => null;
94 91
95 @override 92 @override
96 bool operator ==(Object object) => 93 bool operator ==(Object object) =>
97 object is IndexableName && object.name == name; 94 object is IndexableName && object.name == name;
(...skipping 22 matching lines...) Expand all
120 */ 117 */
121 IndexableNameKind._(this.index) { 118 IndexableNameKind._(this.index) {
122 IndexableObjectKind.register(this); 119 IndexableObjectKind.register(this);
123 } 120 }
124 121
125 @override 122 @override
126 IndexableObject decode(AnalysisContext context, String filePath, int offset) { 123 IndexableObject decode(AnalysisContext context, String filePath, int offset) {
127 throw new UnsupportedError( 124 throw new UnsupportedError(
128 'Indexable names cannot be decoded through their kind'); 125 'Indexable names cannot be decoded through their kind');
129 } 126 }
127
128 @override
129 int encodeHash(StringToInt stringToInt, IndexableObject indexable) {
130 String name = (indexable as IndexableName).name;
131 return stringToInt(name);
132 }
130 } 133 }
131 134
132 /** 135 /**
133 * Constants used when populating and accessing the index. 136 * Constants used when populating and accessing the index.
134 */ 137 */
135 class IndexConstants { 138 class IndexConstants {
136 /** 139 /**
137 * Left: the Universe or a Library. 140 * Left: the Universe or a Library.
138 * Defines an Element. 141 * Defines an Element.
139 * Right: an Element declaration. 142 * Right: an Element declaration.
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after
360 */ 363 */
361 static RelationshipImpl getRelationship(String identifier) { 364 static RelationshipImpl getRelationship(String identifier) {
362 RelationshipImpl relationship = _RELATIONSHIP_MAP[identifier]; 365 RelationshipImpl relationship = _RELATIONSHIP_MAP[identifier];
363 if (relationship == null) { 366 if (relationship == null) {
364 relationship = new RelationshipImpl(identifier); 367 relationship = new RelationshipImpl(identifier);
365 _RELATIONSHIP_MAP[identifier] = relationship; 368 _RELATIONSHIP_MAP[identifier] = relationship;
366 } 369 }
367 return relationship; 370 return relationship;
368 } 371 }
369 } 372 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698