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

Side by Side Diff: pkg/analysis_services/lib/completion/completion_suggestion.dart

Issue 463493003: rename CompletionSuggestionKind.VARIABLE to LOCAL_VARIABLE to match spec (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: merge Created 6 years, 4 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 | Annotate | Revision Log
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.completion.suggestion; 5 library services.completion.suggestion;
6 6
7 import 'package:analysis_services/constants.dart'; 7 import 'package:analysis_services/constants.dart';
8 import 'package:analysis_services/json.dart'; 8 import 'package:analysis_services/json.dart';
9 import 'package:analyzer/src/generated/element.dart'; 9 import 'package:analyzer/src/generated/element.dart';
10 10
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
136 static const CompletionSuggestionKind FUNCTION = 136 static const CompletionSuggestionKind FUNCTION =
137 const CompletionSuggestionKind('FUNCTION'); 137 const CompletionSuggestionKind('FUNCTION');
138 static const CompletionSuggestionKind FUNCTION_TYPE_ALIAS = 138 static const CompletionSuggestionKind FUNCTION_TYPE_ALIAS =
139 const CompletionSuggestionKind('FUNCTION_TYPE_ALIAS'); 139 const CompletionSuggestionKind('FUNCTION_TYPE_ALIAS');
140 static const CompletionSuggestionKind GETTER = 140 static const CompletionSuggestionKind GETTER =
141 const CompletionSuggestionKind('GETTER'); 141 const CompletionSuggestionKind('GETTER');
142 static const CompletionSuggestionKind IMPORT = 142 static const CompletionSuggestionKind IMPORT =
143 const CompletionSuggestionKind('IMPORT'); 143 const CompletionSuggestionKind('IMPORT');
144 static const CompletionSuggestionKind LIBRARY_PREFIX = 144 static const CompletionSuggestionKind LIBRARY_PREFIX =
145 const CompletionSuggestionKind('LIBRARY_PREFIX'); 145 const CompletionSuggestionKind('LIBRARY_PREFIX');
146 static const CompletionSuggestionKind LOCAL_VARIABLE =
147 const CompletionSuggestionKind('LOCAL_VARIABLE');
146 static const CompletionSuggestionKind METHOD = 148 static const CompletionSuggestionKind METHOD =
147 const CompletionSuggestionKind('METHOD'); 149 const CompletionSuggestionKind('METHOD');
148 static const CompletionSuggestionKind METHOD_NAME = 150 static const CompletionSuggestionKind METHOD_NAME =
149 const CompletionSuggestionKind('METHOD_NAME'); 151 const CompletionSuggestionKind('METHOD_NAME');
150 static const CompletionSuggestionKind NAMED_ARGUMENT = 152 static const CompletionSuggestionKind NAMED_ARGUMENT =
151 const CompletionSuggestionKind('NAMED_ARGUMENT'); 153 const CompletionSuggestionKind('NAMED_ARGUMENT');
152 static const CompletionSuggestionKind OPTIONAL_ARGUMENT = 154 static const CompletionSuggestionKind OPTIONAL_ARGUMENT =
153 const CompletionSuggestionKind('OPTIONAL_ARGUMENT'); 155 const CompletionSuggestionKind('OPTIONAL_ARGUMENT');
154 static const CompletionSuggestionKind PARAMETER = 156 static const CompletionSuggestionKind PARAMETER =
155 const CompletionSuggestionKind('PARAMETER'); 157 const CompletionSuggestionKind('PARAMETER');
156 static const CompletionSuggestionKind SETTER = 158 static const CompletionSuggestionKind SETTER =
157 const CompletionSuggestionKind('SETTER'); 159 const CompletionSuggestionKind('SETTER');
158 static const CompletionSuggestionKind TOP_LEVEL_VARIABLE = 160 static const CompletionSuggestionKind TOP_LEVEL_VARIABLE =
159 const CompletionSuggestionKind('TOP_LEVEL_VARIABLE'); 161 const CompletionSuggestionKind('TOP_LEVEL_VARIABLE');
160 static const CompletionSuggestionKind TYPE_PARAMETER = 162 static const CompletionSuggestionKind TYPE_PARAMETER =
161 const CompletionSuggestionKind('TYPE_PARAMETER'); 163 const CompletionSuggestionKind('TYPE_PARAMETER');
162 // TODO (danrubel) consider renaming VARIABLE --> LOCAL_VARIABLE
163 // to match ElementKind.LOCAL_VARIABLE
164 static const CompletionSuggestionKind VARIABLE =
165 const CompletionSuggestionKind('VARIABLE');
166 164
167 final String name; 165 final String name;
168 166
169 const CompletionSuggestionKind(this.name); 167 const CompletionSuggestionKind(this.name);
170 168
171 @override 169 @override
172 String toString() => name; 170 String toString() => name;
173 171
174 static CompletionSuggestionKind fromElementKind(ElementKind kind) { 172 static CompletionSuggestionKind fromElementKind(ElementKind kind) {
175 // ElementKind.ANGULAR_FORMATTER, 173 // ElementKind.ANGULAR_FORMATTER,
(...skipping 13 matching lines...) Expand all
189 // ElementKind.EXPORT, 187 // ElementKind.EXPORT,
190 // ElementKind.EXTERNAL_HTML_SCRIPT, 188 // ElementKind.EXTERNAL_HTML_SCRIPT,
191 if (kind == ElementKind.FIELD) return FIELD; 189 if (kind == ElementKind.FIELD) return FIELD;
192 if (kind == ElementKind.FUNCTION) return FUNCTION; 190 if (kind == ElementKind.FUNCTION) return FUNCTION;
193 if (kind == ElementKind.FUNCTION_TYPE_ALIAS) return FUNCTION_TYPE_ALIAS; 191 if (kind == ElementKind.FUNCTION_TYPE_ALIAS) return FUNCTION_TYPE_ALIAS;
194 if (kind == ElementKind.GETTER) return GETTER; 192 if (kind == ElementKind.GETTER) return GETTER;
195 // ElementKind.HTML, 193 // ElementKind.HTML,
196 if (kind == ElementKind.IMPORT) return IMPORT; 194 if (kind == ElementKind.IMPORT) return IMPORT;
197 // ElementKind.LABEL, 195 // ElementKind.LABEL,
198 // ElementKind.LIBRARY, 196 // ElementKind.LIBRARY,
199 if (kind == ElementKind.LOCAL_VARIABLE) return VARIABLE; 197 if (kind == ElementKind.LOCAL_VARIABLE) return LOCAL_VARIABLE;
200 if (kind == ElementKind.METHOD) return METHOD; 198 if (kind == ElementKind.METHOD) return METHOD;
201 // ElementKind.NAME, 199 // ElementKind.NAME,
202 if (kind == ElementKind.PARAMETER) return PARAMETER; 200 if (kind == ElementKind.PARAMETER) return PARAMETER;
203 // ElementKind.POLYMER_ATTRIBUTE, 201 // ElementKind.POLYMER_ATTRIBUTE,
204 // ElementKind.POLYMER_TAG_DART, 202 // ElementKind.POLYMER_TAG_DART,
205 // ElementKind.POLYMER_TAG_HTML, 203 // ElementKind.POLYMER_TAG_HTML,
206 // ElementKind.PREFIX, 204 // ElementKind.PREFIX,
207 if (kind == ElementKind.SETTER) return SETTER; 205 if (kind == ElementKind.SETTER) return SETTER;
208 if (kind == ElementKind.TOP_LEVEL_VARIABLE) return TOP_LEVEL_VARIABLE; 206 if (kind == ElementKind.TOP_LEVEL_VARIABLE) return TOP_LEVEL_VARIABLE;
209 // ElementKind.TYPE_PARAMETER, 207 // ElementKind.TYPE_PARAMETER,
210 // ElementKind.UNIVERSE 208 // ElementKind.UNIVERSE
211 throw new ArgumentError('Unknown CompletionSuggestionKind for: $kind'); 209 throw new ArgumentError('Unknown CompletionSuggestionKind for: $kind');
212 } 210 }
213 211
214 static CompletionSuggestionKind valueOf(String name) { 212 static CompletionSuggestionKind valueOf(String name) {
215 if (ARGUMENT_LIST.name == name) return ARGUMENT_LIST; 213 if (ARGUMENT_LIST.name == name) return ARGUMENT_LIST;
216 if (CLASS.name == name) return CLASS; 214 if (CLASS.name == name) return CLASS;
217 if (CLASS_ALIAS.name == name) return CLASS_ALIAS; 215 if (CLASS_ALIAS.name == name) return CLASS_ALIAS;
218 if (CONSTRUCTOR.name == name) return CONSTRUCTOR; 216 if (CONSTRUCTOR.name == name) return CONSTRUCTOR;
219 if (FIELD.name == name) return FIELD; 217 if (FIELD.name == name) return FIELD;
220 if (FUNCTION.name == name) return FUNCTION; 218 if (FUNCTION.name == name) return FUNCTION;
221 if (FUNCTION_TYPE_ALIAS.name == name) return FUNCTION_TYPE_ALIAS; 219 if (FUNCTION_TYPE_ALIAS.name == name) return FUNCTION_TYPE_ALIAS;
222 if (GETTER.name == name) return GETTER; 220 if (GETTER.name == name) return GETTER;
223 if (IMPORT.name == name) return IMPORT; 221 if (IMPORT.name == name) return IMPORT;
224 if (LIBRARY_PREFIX.name == name) return LIBRARY_PREFIX; 222 if (LIBRARY_PREFIX.name == name) return LIBRARY_PREFIX;
223 if (LOCAL_VARIABLE.name == name) return LOCAL_VARIABLE;
225 if (METHOD.name == name) return METHOD; 224 if (METHOD.name == name) return METHOD;
226 if (METHOD_NAME.name == name) return METHOD_NAME; 225 if (METHOD_NAME.name == name) return METHOD_NAME;
227 if (NAMED_ARGUMENT.name == name) return NAMED_ARGUMENT; 226 if (NAMED_ARGUMENT.name == name) return NAMED_ARGUMENT;
228 if (OPTIONAL_ARGUMENT.name == name) return OPTIONAL_ARGUMENT; 227 if (OPTIONAL_ARGUMENT.name == name) return OPTIONAL_ARGUMENT;
229 if (PARAMETER.name == name) return PARAMETER; 228 if (PARAMETER.name == name) return PARAMETER;
230 if (SETTER.name == name) return SETTER; 229 if (SETTER.name == name) return SETTER;
231 if (TOP_LEVEL_VARIABLE.name == name) return TOP_LEVEL_VARIABLE; 230 if (TOP_LEVEL_VARIABLE.name == name) return TOP_LEVEL_VARIABLE;
232 if (TYPE_PARAMETER.name == name) return TYPE_PARAMETER; 231 if (TYPE_PARAMETER.name == name) return TYPE_PARAMETER;
233 if (VARIABLE.name == name) return VARIABLE;
234 throw new ArgumentError('Unknown CompletionSuggestionKind: $name'); 232 throw new ArgumentError('Unknown CompletionSuggestionKind: $name');
235 } 233 }
236 } 234 }
OLDNEW
« no previous file with comments | « pkg/analysis_server/test/domain_completion_test.dart ('k') | pkg/analysis_services/lib/src/completion/local_computer.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698