| 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.contributor.dart.invocation; | 5 library services.completion.contributor.dart.invocation; |
| 6 | 6 |
| 7 import 'dart:async'; | 7 import 'dart:async'; |
| 8 | 8 |
| 9 import 'package:analysis_server/src/services/completion/dart_completion_manager.
dart'; | 9 import 'package:analysis_server/src/services/completion/dart_completion_manager.
dart'; |
| 10 import 'package:analysis_server/src/services/completion/local_declaration_visito
r.dart'; | 10 import 'package:analysis_server/src/services/completion/local_declaration_visito
r.dart'; |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 120 referencedFields.add(fieldName); | 120 referencedFields.add(fieldName); |
| 121 } | 121 } |
| 122 } | 122 } |
| 123 } | 123 } |
| 124 } | 124 } |
| 125 | 125 |
| 126 // Add suggestions for fields that are not already referenced | 126 // Add suggestions for fields that are not already referenced |
| 127 ClassDeclaration classDecl = | 127 ClassDeclaration classDecl = |
| 128 constructorDecl.getAncestor((p) => p is ClassDeclaration); | 128 constructorDecl.getAncestor((p) => p is ClassDeclaration); |
| 129 for (ClassMember member in classDecl.members) { | 129 for (ClassMember member in classDecl.members) { |
| 130 if (member is FieldDeclaration) { | 130 if (member is FieldDeclaration && !member.isStatic) { |
| 131 for (VariableDeclaration varDecl in member.fields.variables) { | 131 for (VariableDeclaration varDecl in member.fields.variables) { |
| 132 SimpleIdentifier fieldId = varDecl.name; | 132 SimpleIdentifier fieldId = varDecl.name; |
| 133 if (fieldId != null) { | 133 if (fieldId != null) { |
| 134 String fieldName = fieldId.name; | 134 String fieldName = fieldId.name; |
| 135 if (fieldName != null && fieldName.length > 0) { | 135 if (fieldName != null && fieldName.length > 0) { |
| 136 if (!referencedFields.contains(fieldName)) { | 136 if (!referencedFields.contains(fieldName)) { |
| 137 CompletionSuggestion suggestion = | 137 CompletionSuggestion suggestion = |
| 138 createFieldSuggestion(request.source, member, varDecl); | 138 createFieldSuggestion(request.source, member, varDecl); |
| 139 if (suggestion != null) { | 139 if (suggestion != null) { |
| 140 request.addSuggestion(suggestion); | 140 request.addSuggestion(suggestion); |
| (...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 433 } | 433 } |
| 434 return new Future.value(false); | 434 return new Future.value(false); |
| 435 } | 435 } |
| 436 | 436 |
| 437 @override | 437 @override |
| 438 Future<bool> visitVariableElement(VariableElement element) { | 438 Future<bool> visitVariableElement(VariableElement element) { |
| 439 InterfaceTypeSuggestionBuilder.suggestionsFor(request, element.type); | 439 InterfaceTypeSuggestionBuilder.suggestionsFor(request, element.type); |
| 440 return new Future.value(true); | 440 return new Future.value(true); |
| 441 } | 441 } |
| 442 } | 442 } |
| OLD | NEW |