OLD | NEW |
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.computer.dart.relevance; | 5 library services.completion.computer.dart.relevance; |
6 | 6 |
7 import 'package:analysis_server/src/protocol_server.dart' as protocol; | 7 import 'package:analysis_server/src/protocol_server.dart' as protocol; |
8 import 'package:analysis_server/src/protocol_server.dart' | 8 import 'package:analysis_server/src/protocol_server.dart' |
9 show CompletionSuggestion, CompletionSuggestionKind; | 9 show CompletionSuggestion, CompletionSuggestionKind; |
10 import 'package:analysis_server/src/services/completion/dart_completion_manager.
dart'; | 10 import 'package:analysis_server/src/services/completion/dart_completion_manager.
dart'; |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
92 } | 92 } |
93 } | 93 } |
94 } | 94 } |
95 } | 95 } |
96 } | 96 } |
97 | 97 |
98 /** | 98 /** |
99 * An [AstVisitor] used to determine the best defining type of a node. | 99 * An [AstVisitor] used to determine the best defining type of a node. |
100 */ | 100 */ |
101 class _BestTypeVisitor extends GeneralizingAstVisitor { | 101 class _BestTypeVisitor extends GeneralizingAstVisitor { |
102 | |
103 /** | 102 /** |
104 * The entity which the completed text will replace (or which will be | 103 * The entity which the completed text will replace (or which will be |
105 * displaced once the completed text is inserted). This may be an AstNode or | 104 * displaced once the completed text is inserted). This may be an AstNode or |
106 * a Token, or it may be null if the cursor is after all tokens in the file. | 105 * a Token, or it may be null if the cursor is after all tokens in the file. |
107 * See field of the same name in [CompletionTarget]. | 106 * See field of the same name in [CompletionTarget]. |
108 */ | 107 */ |
109 final Object entity; | 108 final Object entity; |
110 | 109 |
111 _BestTypeVisitor(this.entity); | 110 _BestTypeVisitor(this.entity); |
112 | 111 |
(...skipping 24 matching lines...) Expand all Loading... |
137 DartType visitPropertyAccess(PropertyAccess node) { | 136 DartType visitPropertyAccess(PropertyAccess node) { |
138 if (node.propertyName == entity) { | 137 if (node.propertyName == entity) { |
139 Expression target = node.realTarget; | 138 Expression target = node.realTarget; |
140 if (target != null) { | 139 if (target != null) { |
141 return target.bestType; | 140 return target.bestType; |
142 } | 141 } |
143 } | 142 } |
144 return null; | 143 return null; |
145 } | 144 } |
146 } | 145 } |
OLD | NEW |