| 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 /** | 5 /** |
| 6 * Utilities for converting Dart entities into analysis server's protocol | 6 * Utilities for converting Dart entities into analysis server's protocol |
| 7 * entities. | 7 * entities. |
| 8 */ | 8 */ |
| 9 library analysis_server.plugin.protocol.protocol_dart; | |
| 10 | |
| 11 import 'package:analysis_server/protocol/protocol_generated.dart'; | |
| 12 import 'package:analysis_server/src/protocol_server.dart'; | 9 import 'package:analysis_server/src/protocol_server.dart'; |
| 13 import 'package:analyzer/dart/element/element.dart' as engine; | 10 import 'package:analyzer/dart/element/element.dart' as engine; |
| 14 import 'package:analyzer/src/generated/utilities_dart.dart' as engine; | 11 import 'package:analyzer/src/generated/utilities_dart.dart' as engine; |
| 12 import 'package:analyzer_plugin/protocol/protocol_common.dart'; |
| 15 | 13 |
| 16 /** | 14 /** |
| 17 * Return a protocol [Element] corresponding to the given [engine.Element]. | 15 * Return a protocol [Element] corresponding to the given [engine.Element]. |
| 18 */ | 16 */ |
| 19 Element convertElement(engine.Element element) { | 17 Element convertElement(engine.Element element) { |
| 20 String name = element.displayName; | 18 String name = element.displayName; |
| 21 String elementTypeParameters = _getTypeParametersString(element); | 19 String elementTypeParameters = _getTypeParametersString(element); |
| 22 String elementParameters = _getParametersString(element); | 20 String elementParameters = _getParametersString(element); |
| 23 String elementReturnType = getReturnTypeString(element); | 21 String elementReturnType = getReturnTypeString(element); |
| 24 ElementKind kind = convertElementToElementKind(element); | 22 ElementKind kind = convertElementToElementKind(element); |
| (...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 209 bool _isStatic(engine.Element element) { | 207 bool _isStatic(engine.Element element) { |
| 210 // TODO(scheglov) add isStatic to Element API | 208 // TODO(scheglov) add isStatic to Element API |
| 211 if (element is engine.ExecutableElement) { | 209 if (element is engine.ExecutableElement) { |
| 212 return element.isStatic; | 210 return element.isStatic; |
| 213 } | 211 } |
| 214 if (element is engine.PropertyInducingElement) { | 212 if (element is engine.PropertyInducingElement) { |
| 215 return element.isStatic; | 213 return element.isStatic; |
| 216 } | 214 } |
| 217 return false; | 215 return false; |
| 218 } | 216 } |
| OLD | NEW |