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

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

Issue 1413563004: Make IndexableObjectKind parameterized. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Clean up IndexableElementKind. 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
« no previous file with comments | « pkg/analysis_server/lib/src/services/index/indexable_element.dart ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 services.index.indexable_file; 5 library services.index.indexable_file;
6 6
7 import 'package:analysis_server/plugin/index/index_core.dart'; 7 import 'package:analysis_server/plugin/index/index_core.dart';
8 import 'package:analyzer/src/generated/engine.dart'; 8 import 'package:analyzer/src/generated/engine.dart';
9 9
10 /** 10 /**
(...skipping 24 matching lines...) Expand all
35 bool operator ==(Object object) => 35 bool operator ==(Object object) =>
36 object is IndexableFile && object.path == path; 36 object is IndexableFile && object.path == path;
37 37
38 @override 38 @override
39 String toString() => path; 39 String toString() => path;
40 } 40 }
41 41
42 /** 42 /**
43 * The kind of an indexable file. 43 * The kind of an indexable file.
44 */ 44 */
45 class IndexableFileKind implements IndexableObjectKind { 45 class IndexableFileKind implements IndexableObjectKind<IndexableFile> {
46 /** 46 /**
47 * The unique instance of this class. 47 * The unique instance of this class.
48 */ 48 */
49 static final IndexableFileKind INSTANCE = 49 static final IndexableFileKind INSTANCE =
50 new IndexableFileKind._(IndexableObjectKind.nextIndex); 50 new IndexableFileKind._(IndexableObjectKind.nextIndex);
51 51
52 /** 52 /**
53 * The index uniquely identifying this kind. 53 * The index uniquely identifying this kind.
54 */ 54 */
55 final int index; 55 final int index;
56 56
57 /** 57 /**
58 * Initialize a newly created kind to have the given [index]. 58 * Initialize a newly created kind to have the given [index].
59 */ 59 */
60 IndexableFileKind._(this.index) { 60 IndexableFileKind._(this.index) {
61 IndexableObjectKind.register(this); 61 IndexableObjectKind.register(this);
62 } 62 }
63 63
64 @override 64 @override
65 IndexableObject decode(AnalysisContext context, String filePath, int offset) { 65 IndexableFile decode(AnalysisContext context, String filePath, int offset) {
66 return new IndexableFile(filePath); 66 return new IndexableFile(filePath);
67 } 67 }
68 68
69 @override 69 @override
70 int encodeHash(StringToInt stringToInt, IndexableObject indexable) { 70 int encodeHash(StringToInt stringToInt, IndexableFile indexable) {
71 String path = (indexable as IndexableFile).path; 71 String path = indexable.path;
72 return stringToInt(path); 72 return stringToInt(path);
73 } 73 }
74 } 74 }
OLDNEW
« no previous file with comments | « pkg/analysis_server/lib/src/services/index/indexable_element.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698