| OLD | NEW |
| 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 computer.element; | 5 library computer.element; |
| 6 | 6 |
| 7 import 'package:analysis_server/src/constants.dart'; | 7 import 'package:analysis_server/src/constants.dart'; |
| 8 import 'package:analyzer/src/generated/element.dart' as engine; | 8 import 'package:analyzer/src/generated/element.dart' as engine; |
| 9 import 'package:analyzer/src/generated/source.dart'; | 9 import 'package:analyzer/src/generated/source.dart'; |
| 10 import 'package:analyzer/src/generated/utilities_dart.dart' as engine; | 10 import 'package:analyzer/src/generated/utilities_dart.dart' as engine; |
| (...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 224 static const CLASS_TYPE_ALIAS = const ElementKind('CLASS_TYPE_ALIAS'); | 224 static const CLASS_TYPE_ALIAS = const ElementKind('CLASS_TYPE_ALIAS'); |
| 225 static const COMPILATION_UNIT = const ElementKind('COMPILATION_UNIT'); | 225 static const COMPILATION_UNIT = const ElementKind('COMPILATION_UNIT'); |
| 226 static const CONSTRUCTOR = const ElementKind('CONSTRUCTOR'); | 226 static const CONSTRUCTOR = const ElementKind('CONSTRUCTOR'); |
| 227 static const FIELD = const ElementKind('FIELD'); | 227 static const FIELD = const ElementKind('FIELD'); |
| 228 static const FUNCTION = const ElementKind('FUNCTION'); | 228 static const FUNCTION = const ElementKind('FUNCTION'); |
| 229 static const FUNCTION_TYPE_ALIAS = const ElementKind('FUNCTION_TYPE_ALIAS'); | 229 static const FUNCTION_TYPE_ALIAS = const ElementKind('FUNCTION_TYPE_ALIAS'); |
| 230 static const GETTER = const ElementKind('GETTER'); | 230 static const GETTER = const ElementKind('GETTER'); |
| 231 static const LIBRARY = const ElementKind('LIBRARY'); | 231 static const LIBRARY = const ElementKind('LIBRARY'); |
| 232 static const LOCAL_VARIABLE = const ElementKind('LOCAL_VARIABLE'); | 232 static const LOCAL_VARIABLE = const ElementKind('LOCAL_VARIABLE'); |
| 233 static const METHOD = const ElementKind('METHOD'); | 233 static const METHOD = const ElementKind('METHOD'); |
| 234 static const PARAMETER = const ElementKind('PARAMETER'); |
| 234 static const SETTER = const ElementKind('SETTER'); | 235 static const SETTER = const ElementKind('SETTER'); |
| 235 static const TOP_LEVEL_VARIABLE = const ElementKind('TOP_LEVEL_VARIABLE'); | 236 static const TOP_LEVEL_VARIABLE = const ElementKind('TOP_LEVEL_VARIABLE'); |
| 237 static const TYPE_PARAMETER = const ElementKind('TYPE_PARAMETER'); |
| 236 static const UNIT_TEST_CASE = const ElementKind('UNIT_TEST_CASE'); | 238 static const UNIT_TEST_CASE = const ElementKind('UNIT_TEST_CASE'); |
| 237 static const UNIT_TEST_GROUP = const ElementKind('UNIT_TEST_GROUP'); | 239 static const UNIT_TEST_GROUP = const ElementKind('UNIT_TEST_GROUP'); |
| 238 static const UNKNOWN = const ElementKind('UNKNOWN'); | 240 static const UNKNOWN = const ElementKind('UNKNOWN'); |
| 239 | 241 |
| 240 final String name; | 242 final String name; |
| 241 | 243 |
| 242 const ElementKind(this.name); | 244 const ElementKind(this.name); |
| 243 | 245 |
| 244 @override | 246 @override |
| 245 String toString() => name; | 247 String toString() => name; |
| 246 | 248 |
| 247 static ElementKind valueOf(String name) { | 249 static ElementKind valueOf(String name) { |
| 248 if (CLASS.name == name) return CLASS; | 250 if (CLASS.name == name) return CLASS; |
| 249 if (CLASS_TYPE_ALIAS.name == name) return CLASS_TYPE_ALIAS; | 251 if (CLASS_TYPE_ALIAS.name == name) return CLASS_TYPE_ALIAS; |
| 250 if (COMPILATION_UNIT.name == name) return COMPILATION_UNIT; | 252 if (COMPILATION_UNIT.name == name) return COMPILATION_UNIT; |
| 251 if (CONSTRUCTOR.name == name) return CONSTRUCTOR; | 253 if (CONSTRUCTOR.name == name) return CONSTRUCTOR; |
| 252 if (FIELD.name == name) return FIELD; | 254 if (FIELD.name == name) return FIELD; |
| 253 if (FUNCTION.name == name) return FUNCTION; | 255 if (FUNCTION.name == name) return FUNCTION; |
| 254 if (FUNCTION_TYPE_ALIAS.name == name) return FUNCTION_TYPE_ALIAS; | 256 if (FUNCTION_TYPE_ALIAS.name == name) return FUNCTION_TYPE_ALIAS; |
| 255 if (GETTER.name == name) return GETTER; | 257 if (GETTER.name == name) return GETTER; |
| 256 if (LIBRARY.name == name) return LIBRARY; | 258 if (LIBRARY.name == name) return LIBRARY; |
| 257 if (LOCAL_VARIABLE.name == name) return LOCAL_VARIABLE; | 259 if (LOCAL_VARIABLE.name == name) return LOCAL_VARIABLE; |
| 258 if (METHOD.name == name) return METHOD; | 260 if (METHOD.name == name) return METHOD; |
| 261 if (PARAMETER.name == name) return PARAMETER; |
| 259 if (SETTER.name == name) return SETTER; | 262 if (SETTER.name == name) return SETTER; |
| 260 if (TOP_LEVEL_VARIABLE.name == name) return TOP_LEVEL_VARIABLE; | 263 if (TOP_LEVEL_VARIABLE.name == name) return TOP_LEVEL_VARIABLE; |
| 264 if (TYPE_PARAMETER.name == name) return TYPE_PARAMETER; |
| 261 if (UNIT_TEST_CASE.name == name) return UNIT_TEST_CASE; | 265 if (UNIT_TEST_CASE.name == name) return UNIT_TEST_CASE; |
| 262 if (UNIT_TEST_GROUP.name == name) return UNIT_TEST_GROUP; | 266 if (UNIT_TEST_GROUP.name == name) return UNIT_TEST_GROUP; |
| 263 if (UNKNOWN.name == name) return UNKNOWN; | 267 if (UNKNOWN.name == name) return UNKNOWN; |
| 264 throw new ArgumentError('Unknown ElementKind: $name'); | 268 throw new ArgumentError('Unknown ElementKind: $name'); |
| 265 } | 269 } |
| 266 | 270 |
| 267 static ElementKind valueOfEngine(engine.ElementKind kind) { | 271 static ElementKind valueOfEngine(engine.ElementKind kind) { |
| 268 if (kind == engine.ElementKind.CLASS) { | 272 if (kind == engine.ElementKind.CLASS) { |
| 269 return CLASS; | 273 return CLASS; |
| 270 } | 274 } |
| (...skipping 17 matching lines...) Expand all Loading... |
| 288 } | 292 } |
| 289 if (kind == engine.ElementKind.LIBRARY) { | 293 if (kind == engine.ElementKind.LIBRARY) { |
| 290 return LIBRARY; | 294 return LIBRARY; |
| 291 } | 295 } |
| 292 if (kind == engine.ElementKind.LOCAL_VARIABLE) { | 296 if (kind == engine.ElementKind.LOCAL_VARIABLE) { |
| 293 return LOCAL_VARIABLE; | 297 return LOCAL_VARIABLE; |
| 294 } | 298 } |
| 295 if (kind == engine.ElementKind.METHOD) { | 299 if (kind == engine.ElementKind.METHOD) { |
| 296 return METHOD; | 300 return METHOD; |
| 297 } | 301 } |
| 302 if (kind == engine.ElementKind.PARAMETER) { |
| 303 return PARAMETER; |
| 304 } |
| 298 if (kind == engine.ElementKind.SETTER) { | 305 if (kind == engine.ElementKind.SETTER) { |
| 299 return SETTER; | 306 return SETTER; |
| 300 } | 307 } |
| 301 if (kind == engine.ElementKind.TOP_LEVEL_VARIABLE) { | 308 if (kind == engine.ElementKind.TOP_LEVEL_VARIABLE) { |
| 302 return TOP_LEVEL_VARIABLE; | 309 return TOP_LEVEL_VARIABLE; |
| 303 } | 310 } |
| 311 if (kind == engine.ElementKind.TYPE_PARAMETER) { |
| 312 return TYPE_PARAMETER; |
| 313 } |
| 304 return UNKNOWN; | 314 return UNKNOWN; |
| 305 } | 315 } |
| 306 } | 316 } |
| 307 | 317 |
| 308 | 318 |
| 309 /** | 319 /** |
| 310 * Information about a location. | 320 * Information about a location. |
| 311 */ | 321 */ |
| 312 class Location { | 322 class Location { |
| 313 final String file; | 323 final String file; |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 378 START_COLUMN: startColumn | 388 START_COLUMN: startColumn |
| 379 }; | 389 }; |
| 380 } | 390 } |
| 381 | 391 |
| 382 @override | 392 @override |
| 383 String toString() { | 393 String toString() { |
| 384 return 'Location(file=$file; offset=$offset; length=$length; ' | 394 return 'Location(file=$file; offset=$offset; length=$length; ' |
| 385 'startLine=$startLine; startColumn=$startColumn)'; | 395 'startLine=$startLine; startColumn=$startColumn)'; |
| 386 } | 396 } |
| 387 } | 397 } |
| OLD | NEW |