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

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

Issue 1008533002: Completion breaks if core is not analyzed (issue 22814) (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 years, 9 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 180 matching lines...) Expand 10 before | Expand all | Expand 10 after
191 } 191 }
192 } 192 }
193 } 193 }
194 194
195 /** 195 /**
196 * Add suggestions for implicitly imported elements in dart:core. 196 * Add suggestions for implicitly imported elements in dart:core.
197 */ 197 */
198 void _addDartCoreSuggestions() { 198 void _addDartCoreSuggestions() {
199 Source coreUri = context.sourceFactory.forUri('dart:core'); 199 Source coreUri = context.sourceFactory.forUri('dart:core');
200 LibraryElement coreLib = context.getLibraryElement(coreUri); 200 LibraryElement coreLib = context.getLibraryElement(coreUri);
201 if (coreLib == null) {
202 // If the core library has not been analyzed yet, then we cannot add any
203 // suggestions from it.
204 return;
205 }
201 Namespace coreNamespace = 206 Namespace coreNamespace =
202 new NamespaceBuilder().createPublicNamespaceForLibrary(coreLib); 207 new NamespaceBuilder().createPublicNamespaceForLibrary(coreLib);
203 coreNamespace.definedNames.forEach((String name, Element elem) { 208 coreNamespace.definedNames.forEach((String name, Element elem) {
204 if (elem is ClassElement) { 209 if (elem is ClassElement) {
205 importedClassMap[name] = elem; 210 importedClassMap[name] = elem;
206 } 211 }
207 _addSuggestion(elem, DART_RELEVANCE_DEFAULT); 212 _addSuggestion(elem, DART_RELEVANCE_DEFAULT);
208 }); 213 });
209 } 214 }
210 215
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after
378 @override 383 @override
379 void visitFunctionTypeAliasElement(FunctionTypeAliasElement element) { 384 void visitFunctionTypeAliasElement(FunctionTypeAliasElement element) {
380 cache._addSuggestion(element, DART_RELEVANCE_DEFAULT); 385 cache._addSuggestion(element, DART_RELEVANCE_DEFAULT);
381 } 386 }
382 387
383 @override 388 @override
384 void visitTopLevelVariableElement(TopLevelVariableElement element) { 389 void visitTopLevelVariableElement(TopLevelVariableElement element) {
385 cache._addSuggestion(element, DART_RELEVANCE_DEFAULT); 390 cache._addSuggestion(element, DART_RELEVANCE_DEFAULT);
386 } 391 }
387 } 392 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698