OLD | NEW |
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, 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.constructor; | 5 library services.completion.contributor.dart.constructor; |
6 | 6 |
7 import 'dart:async'; | 7 import 'dart:async'; |
8 | 8 |
9 import 'package:analysis_server/plugin/protocol/protocol.dart' as protocol | 9 import 'package:analysis_server/plugin/protocol/protocol.dart' as protocol |
10 show Element, ElementKind; | 10 show Element, ElementKind; |
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
174 } | 174 } |
175 | 175 |
176 /** | 176 /** |
177 * A visitor for collecting constructor suggestions. | 177 * A visitor for collecting constructor suggestions. |
178 */ | 178 */ |
179 class _Visitor extends LocalDeclarationVisitor { | 179 class _Visitor extends LocalDeclarationVisitor { |
180 final DartCompletionRequest request; | 180 final DartCompletionRequest request; |
181 final List<CompletionSuggestion> suggestions; | 181 final List<CompletionSuggestion> suggestions; |
182 | 182 |
183 _Visitor(DartCompletionRequest request, this.suggestions) | 183 _Visitor(DartCompletionRequest request, this.suggestions) |
184 : super(request.offset), | 184 : request = request, |
185 request = request; | 185 super(request.offset); |
186 | 186 |
187 @override | 187 @override |
188 void declaredClass(ClassDeclaration declaration) { | 188 void declaredClass(ClassDeclaration declaration) { |
189 bool found = false; | 189 bool found = false; |
190 for (ClassMember member in declaration.members) { | 190 for (ClassMember member in declaration.members) { |
191 if (member is ConstructorDeclaration) { | 191 if (member is ConstructorDeclaration) { |
192 found = true; | 192 found = true; |
193 _addSuggestion(declaration, member); | 193 _addSuggestion(declaration, member); |
194 } | 194 } |
195 } | 195 } |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
273 declaringType: classDecl.name.name, | 273 declaringType: classDecl.name.name, |
274 element: element, | 274 element: element, |
275 parameterNames: [], | 275 parameterNames: [], |
276 parameterTypes: [], | 276 parameterTypes: [], |
277 requiredParameterCount: 0, | 277 requiredParameterCount: 0, |
278 hasNamedParameters: false); | 278 hasNamedParameters: false); |
279 suggestions.add(suggestion); | 279 suggestions.add(suggestion); |
280 } | 280 } |
281 } | 281 } |
282 } | 282 } |
OLD | NEW |