| 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 services.completion.suggestion.builder; | 5 library services.completion.suggestion.builder; |
| 6 | 6 |
| 7 import 'dart:async'; | 7 import 'dart:async'; |
| 8 | 8 |
| 9 import 'package:analysis_server/src/protocol_server.dart' as protocol; | 9 import 'package:analysis_server/src/protocol_server.dart' as protocol; |
| 10 import 'package:analysis_server/src/protocol_server.dart' hide Element, | 10 import 'package:analysis_server/src/protocol_server.dart' hide Element, |
| (...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 189 element.returnType, | 189 element.returnType, |
| 190 element.enclosingElement); | 190 element.enclosingElement); |
| 191 } | 191 } |
| 192 } | 192 } |
| 193 | 193 |
| 194 /** | 194 /** |
| 195 * Add suggestions for the visible members in the given class | 195 * Add suggestions for the visible members in the given class |
| 196 */ | 196 */ |
| 197 static void suggestionsFor(DartCompletionRequest request, Element element, | 197 static void suggestionsFor(DartCompletionRequest request, Element element, |
| 198 {bool staticOnly: false}) { | 198 {bool staticOnly: false}) { |
| 199 if (element == DynamicElementImpl.instance) { |
| 200 element = request.cache.objectClassElement; |
| 201 } |
| 199 if (element is ClassElement) { | 202 if (element is ClassElement) { |
| 200 return element.accept( | 203 return element.accept( |
| 201 new ClassElementSuggestionBuilder(request, staticOnly)); | 204 new ClassElementSuggestionBuilder(request, staticOnly)); |
| 202 } | 205 } |
| 203 } | 206 } |
| 204 } | 207 } |
| 205 | 208 |
| 206 /** | 209 /** |
| 207 * This class visits elements in a library and provides suggestions based upon | 210 * This class visits elements in a library and provides suggestions based upon |
| 208 * the visible members in that library. Clients should call | 211 * the visible members in that library. Clients should call |
| (...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 376 } | 379 } |
| 377 if (type != null) { | 380 if (type != null) { |
| 378 String typeName = type.displayName; | 381 String typeName = type.displayName; |
| 379 if (typeName != null && typeName.length > 0 && typeName != 'dynamic') { | 382 if (typeName != null && typeName.length > 0 && typeName != 'dynamic') { |
| 380 suggestion.returnType = typeName; | 383 suggestion.returnType = typeName; |
| 381 } | 384 } |
| 382 } | 385 } |
| 383 request.suggestions.add(suggestion); | 386 request.suggestions.add(suggestion); |
| 384 } | 387 } |
| 385 } | 388 } |
| OLD | NEW |