mirror of
https://github.com/dart-lang/sdk
synced 2024-11-02 14:32:24 +00:00
Small optimization in named_constructor_contributor.dart to not reference the libraryElement until we know that the contributor will be used.
Change-Id: Ic0624568bd8ae4caec6f49c9ea132fcd17230b95 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/150167 Reviewed-by: Brian Wilkerson <brianwilkerson@google.com> Commit-Queue: Jaime Wren <jwren@google.com>
This commit is contained in:
parent
48d105a551
commit
fbfb3a29c5
1 changed files with 4 additions and 6 deletions
|
@ -19,13 +19,11 @@ class NamedConstructorContributor extends DartCompletionContributor {
|
|||
Future<List<CompletionSuggestion>> computeSuggestions(
|
||||
DartCompletionRequest request, SuggestionBuilder builder) async {
|
||||
var node = request.target.containingNode;
|
||||
var libraryElement = request.libraryElement;
|
||||
if (libraryElement == null) {
|
||||
return const <CompletionSuggestion>[];
|
||||
}
|
||||
|
||||
// Build the list of suggestions
|
||||
if (node is ConstructorName) {
|
||||
var libraryElement = request.libraryElement;
|
||||
if (libraryElement == null) {
|
||||
return const <CompletionSuggestion>[];
|
||||
}
|
||||
var typeName = node.type;
|
||||
if (typeName != null) {
|
||||
var type = typeName.type;
|
||||
|
|
Loading…
Reference in a new issue