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.toplevel; | 5 library services.completion.contributor.dart.toplevel; |
6 | 6 |
7 import 'dart:async'; | 7 import 'dart:async'; |
8 import 'dart:collection'; | 8 import 'dart:collection'; |
9 | 9 |
10 import 'package:analysis_server/src/protocol_server.dart' | 10 import 'package:analysis_server/src/protocol_server.dart' |
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
180 } | 180 } |
181 } | 181 } |
182 }); | 182 }); |
183 } | 183 } |
184 | 184 |
185 /** | 185 /** |
186 * Add suggestions for any inherited imported members. | 186 * Add suggestions for any inherited imported members. |
187 */ | 187 */ |
188 void _addInheritedSuggestions(AstNode node) { | 188 void _addInheritedSuggestions(AstNode node) { |
189 var classDecl = node.getAncestor((p) => p is ClassDeclaration); | 189 var classDecl = node.getAncestor((p) => p is ClassDeclaration); |
190 if (classDecl is ClassDeclaration) { | 190 if (classDecl is ClassDeclaration && !optype.inStaticMethodBody) { |
191 // Build a list of inherited types that are imported | 191 // Build a list of inherited types that are imported |
192 // and include any inherited imported members | 192 // and include any inherited imported members |
193 List<String> inheritedTypes = new List<String>(); | 193 List<String> inheritedTypes = new List<String>(); |
194 // local declarations are handled by the local reference contributor | 194 // local declarations are handled by the local reference contributor |
195 visitInheritedTypes(classDecl, importedTypeName: (String typeName) { | 195 visitInheritedTypes(classDecl, importedTypeName: (String typeName) { |
196 inheritedTypes.add(typeName); | 196 inheritedTypes.add(typeName); |
197 }); | 197 }); |
198 HashSet<String> visited = new HashSet<String>(); | 198 HashSet<String> visited = new HashSet<String>(); |
199 while (inheritedTypes.length > 0) { | 199 while (inheritedTypes.length > 0) { |
200 String name = inheritedTypes.removeLast(); | 200 String name = inheritedTypes.removeLast(); |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
254 _addFilteredSuggestions(filterText, cache.libraryPrefixSuggestions); | 254 _addFilteredSuggestions(filterText, cache.libraryPrefixSuggestions); |
255 } | 255 } |
256 if (optype.includeReturnValueSuggestions) { | 256 if (optype.includeReturnValueSuggestions) { |
257 _addFilteredSuggestions(filterText, cache.otherImportedSuggestions); | 257 _addFilteredSuggestions(filterText, cache.otherImportedSuggestions); |
258 } | 258 } |
259 if (optype.includeVoidReturnSuggestions) { | 259 if (optype.includeVoidReturnSuggestions) { |
260 _addFilteredSuggestions(filterText, cache.importedVoidReturnSuggestions); | 260 _addFilteredSuggestions(filterText, cache.importedVoidReturnSuggestions); |
261 } | 261 } |
262 } | 262 } |
263 } | 263 } |
OLD | NEW |