Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(400)

Side by Side Diff: pkg/analysis_server/lib/src/services/completion/dart_completion_cache.dart

Issue 1060713005: rename completion computer to contributor (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: merge Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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.dart.cache; 5 library services.completion.dart.cache;
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 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
120 importedConstructorSuggestions = <CompletionSuggestion>[]; 120 importedConstructorSuggestions = <CompletionSuggestion>[];
121 importedVoidReturnSuggestions = <CompletionSuggestion>[]; 121 importedVoidReturnSuggestions = <CompletionSuggestion>[];
122 importedClassMap = new Map<String, ClassElement>(); 122 importedClassMap = new Map<String, ClassElement>();
123 _importedCompletions = new HashSet<String>(); 123 _importedCompletions = new HashSet<String>();
124 124
125 // Assert that the compilation unit is resolved 125 // Assert that the compilation unit is resolved
126 // and represents the expected source 126 // and represents the expected source
127 assert(unit.element.source == source); 127 assert(unit.element.source == source);
128 128
129 // Exclude elements from local library 129 // Exclude elements from local library
130 // because they are provided by LocalComputer 130 // because they are provided by LocalReferenceContributor
131 Set<LibraryElement> excludedLibs = new Set<LibraryElement>(); 131 Set<LibraryElement> excludedLibs = new Set<LibraryElement>();
132 excludedLibs.add(unit.element.enclosingElement); 132 excludedLibs.add(unit.element.enclosingElement);
133 133
134 // Determine the compilation unit defining the library containing 134 // Determine the compilation unit defining the library containing
135 // this compilation unit 135 // this compilation unit
136 List<Source> libraries = context.getLibrariesContaining(source); 136 List<Source> libraries = context.getLibrariesContaining(source);
137 assert(libraries != null); 137 assert(libraries != null);
138 Source libSource = libraries.length > 0 ? libraries[0] : null; 138 Source libSource = libraries.length > 0 ? libraries[0] : null;
139 Future<CompilationUnit> futureLibUnit = _computeLibUnit(libSource, unit); 139 Future<CompilationUnit> futureLibUnit = _computeLibUnit(libSource, unit);
140 140
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
230 .createImportNamespaceForDirective(importElem); 230 .createImportNamespaceForDirective(importElem);
231 // Include top level elements 231 // Include top level elements
232 importNamespace.definedNames.forEach((String name, Element elem) { 232 importNamespace.definedNames.forEach((String name, Element elem) {
233 if (elem is ClassElement) { 233 if (elem is ClassElement) {
234 importedClassMap[name] = elem; 234 importedClassMap[name] = elem;
235 } 235 }
236 _addSuggestion(elem, DART_RELEVANCE_DEFAULT); 236 _addSuggestion(elem, DART_RELEVANCE_DEFAULT);
237 }); 237 });
238 } else { 238 } else {
239 // Exclude elements from prefixed imports 239 // Exclude elements from prefixed imports
240 // because they are provided by InvocationComputer 240 // because they are provided by PrefixedElementContributor
241 _addLibraryPrefixSuggestion(importElem); 241 _addLibraryPrefixSuggestion(importElem);
242 excludedLibs.add(importElem.importedLibrary); 242 excludedLibs.add(importElem.importedLibrary);
243 } 243 }
244 } 244 }
245 } else if (directive is PartDirective) { 245 } else if (directive is PartDirective) {
246 CompilationUnitElement partElem = directive.element; 246 CompilationUnitElement partElem = directive.element;
247 if (partElem != null && partElem.source != source) { 247 if (partElem != null && partElem.source != source) {
248 partElem.accept(new _NonLocalElementCacheVisitor(this)); 248 partElem.accept(new _NonLocalElementCacheVisitor(this));
249 } 249 }
250 } 250 }
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
384 @override 384 @override
385 void visitFunctionTypeAliasElement(FunctionTypeAliasElement element) { 385 void visitFunctionTypeAliasElement(FunctionTypeAliasElement element) {
386 cache._addSuggestion(element, DART_RELEVANCE_DEFAULT); 386 cache._addSuggestion(element, DART_RELEVANCE_DEFAULT);
387 } 387 }
388 388
389 @override 389 @override
390 void visitTopLevelVariableElement(TopLevelVariableElement element) { 390 void visitTopLevelVariableElement(TopLevelVariableElement element) {
391 cache._addSuggestion(element, DART_RELEVANCE_DEFAULT); 391 cache._addSuggestion(element, DART_RELEVANCE_DEFAULT);
392 } 392 }
393 } 393 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698