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

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

Issue 783383003: code completion for dynamic type elements (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | pkg/analysis_server/lib/src/services/completion/suggestion_builder.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analysis_server/lib/src/services/completion/dart_completion_cache.dart
diff --git a/pkg/analysis_server/lib/src/services/completion/dart_completion_cache.dart b/pkg/analysis_server/lib/src/services/completion/dart_completion_cache.dart
index 87ae27c618fa7c0b401792e8609017edf7602af5..f1e7198937ac0e13e794be23acb3b9497e1f46b8 100644
--- a/pkg/analysis_server/lib/src/services/completion/dart_completion_cache.dart
+++ b/pkg/analysis_server/lib/src/services/completion/dart_completion_cache.dart
@@ -66,6 +66,11 @@ class DartCompletionCache extends CompletionCache {
*/
Map<String, ClassElement> importedClassMap;
+ /**
+ * The [ClassElement] for Object.
+ */
+ ClassElement _objectClassElement;
+
DartCompletionCache(AnalysisContext context, Source source)
: super(context, source);
@@ -132,6 +137,7 @@ class DartCompletionCache extends CompletionCache {
}
addSuggestion(elem, CompletionRelevance.DEFAULT);
});
+ _objectClassElement = importedClassMap['Object'];
/*
* Don't wait for search of lower relevance results to complete.
@@ -159,6 +165,20 @@ class DartCompletionCache extends CompletionCache {
}
/**
+ * Return the [ClassElement] for Object.
+ */
+ ClassElement get objectClassElement {
+ if (_objectClassElement == null) {
+ Source coreUri = context.sourceFactory.forUri('dart:core');
+ LibraryElement coreLib = context.getLibraryElement(coreUri);
+ Namespace coreNamespace =
+ new NamespaceBuilder().createPublicNamespaceForLibrary(coreLib);
+ _objectClassElement = coreNamespace.definedNames['Object'];
+ }
+ return _objectClassElement;
+ }
+
+ /**
* Return `true` if the import information is cached for the given
* compilation unit.
*/
« no previous file with comments | « no previous file | pkg/analysis_server/lib/src/services/completion/suggestion_builder.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698