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

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

Issue 1504223005: extract TypeMemberContributor from prefixed element contributor (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: mege Created 5 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 unified diff | Download patch
OLDNEW
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.dart.manager; 5 library services.completion.dart.manager;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 8
9 import 'package:analysis_server/plugin/protocol/protocol.dart'; 9 import 'package:analysis_server/plugin/protocol/protocol.dart';
10 import 'package:analysis_server/src/provisional/completion/completion_core.dart' 10 import 'package:analysis_server/src/provisional/completion/completion_core.dart'
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 * The information about a requested list of completions within a Dart file. 58 * The information about a requested list of completions within a Dart file.
59 */ 59 */
60 class DartCompletionRequestImpl extends CompletionRequestImpl 60 class DartCompletionRequestImpl extends CompletionRequestImpl
61 implements DartCompletionRequest { 61 implements DartCompletionRequest {
62 /** 62 /**
63 * The cached completion target or `null` if not computed yet. 63 * The cached completion target or `null` if not computed yet.
64 */ 64 */
65 CompletionTarget _target; 65 CompletionTarget _target;
66 66
67 /** 67 /**
68 * The [DartType] for Object in dart:core
69 */
70 InterfaceType _objectType;
71
72 /**
68 * `true` if [resolveDeclarationsInScope] has partially resolved the unit 73 * `true` if [resolveDeclarationsInScope] has partially resolved the unit
69 * referenced by [target], else `false`. 74 * referenced by [target], else `false`.
70 */ 75 */
71 bool _haveResolveDeclarationsInScope = false; 76 bool _haveResolveDeclarationsInScope = false;
72 77
73 /** 78 /**
74 * Initialize a newly created completion request based on the given request. 79 * Initialize a newly created completion request based on the given request.
75 */ 80 */
76 factory DartCompletionRequestImpl.forRequest(CompletionRequest request) { 81 factory DartCompletionRequestImpl.forRequest(CompletionRequest request) {
77 return new DartCompletionRequestImpl._( 82 return new DartCompletionRequestImpl._(
(...skipping 19 matching lines...) Expand all
97 if (unit != null) { 102 if (unit != null) {
98 CompilationUnitElement elem = unit.element; 103 CompilationUnitElement elem = unit.element;
99 if (elem != null) { 104 if (elem != null) {
100 return elem.library; 105 return elem.library;
101 } 106 }
102 } 107 }
103 return null; 108 return null;
104 } 109 }
105 110
106 @override 111 @override
112 InterfaceType get objectType {
113 if (_objectType == null) {
114 Source coreUri = context.sourceFactory.forUri('dart:core');
115 LibraryElement coreLib = context.getLibraryElement(coreUri);
116 _objectType = coreLib.getType('Object').type;
117 }
118 return _objectType;
119 }
120
121 @override
107 CompletionTarget get target { 122 CompletionTarget get target {
108 if (_target == null) { 123 if (_target == null) {
109 CompilationUnit unit = context.computeResult(source, PARSED_UNIT); 124 CompilationUnit unit = context.computeResult(source, PARSED_UNIT);
110 _target = new CompletionTarget.forOffset(unit, offset); 125 _target = new CompletionTarget.forOffset(unit, offset);
111 } 126 }
112 return _target; 127 return _target;
113 } 128 }
114 129
115 @override 130 @override
116 Future<CompilationUnit> resolveDeclarationsInScope() async { 131 Future<CompilationUnit> resolveDeclarationsInScope() async {
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
186 // Gracefully degrade if unit cannot be resolved 201 // Gracefully degrade if unit cannot be resolved
187 if (resolvedUnit == null) { 202 if (resolvedUnit == null) {
188 return; 203 return;
189 } 204 }
190 205
191 // Recompute the target for the newly resolved unit 206 // Recompute the target for the newly resolved unit
192 _target = new CompletionTarget.forOffset(resolvedUnit, offset); 207 _target = new CompletionTarget.forOffset(resolvedUnit, offset);
193 _haveResolveDeclarationsInScope = true; 208 _haveResolveDeclarationsInScope = true;
194 } 209 }
195 } 210 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698