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

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

Issue 1365403002: Do not suggest static fields in constructor initializer - fixes #24256 (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 2 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
« no previous file with comments | « no previous file | pkg/analysis_server/test/services/completion/completion_test_util.dart » ('j') | 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.contributor.dart.invocation; 5 library services.completion.contributor.dart.invocation;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 8
9 import 'package:analysis_server/src/services/completion/dart_completion_manager. dart'; 9 import 'package:analysis_server/src/services/completion/dart_completion_manager. dart';
10 import 'package:analysis_server/src/services/completion/local_declaration_visito r.dart'; 10 import 'package:analysis_server/src/services/completion/local_declaration_visito r.dart';
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
120 referencedFields.add(fieldName); 120 referencedFields.add(fieldName);
121 } 121 }
122 } 122 }
123 } 123 }
124 } 124 }
125 125
126 // Add suggestions for fields that are not already referenced 126 // Add suggestions for fields that are not already referenced
127 ClassDeclaration classDecl = 127 ClassDeclaration classDecl =
128 constructorDecl.getAncestor((p) => p is ClassDeclaration); 128 constructorDecl.getAncestor((p) => p is ClassDeclaration);
129 for (ClassMember member in classDecl.members) { 129 for (ClassMember member in classDecl.members) {
130 if (member is FieldDeclaration) { 130 if (member is FieldDeclaration && !member.isStatic) {
131 for (VariableDeclaration varDecl in member.fields.variables) { 131 for (VariableDeclaration varDecl in member.fields.variables) {
132 SimpleIdentifier fieldId = varDecl.name; 132 SimpleIdentifier fieldId = varDecl.name;
133 if (fieldId != null) { 133 if (fieldId != null) {
134 String fieldName = fieldId.name; 134 String fieldName = fieldId.name;
135 if (fieldName != null && fieldName.length > 0) { 135 if (fieldName != null && fieldName.length > 0) {
136 if (!referencedFields.contains(fieldName)) { 136 if (!referencedFields.contains(fieldName)) {
137 CompletionSuggestion suggestion = 137 CompletionSuggestion suggestion =
138 createFieldSuggestion(request.source, member, varDecl); 138 createFieldSuggestion(request.source, member, varDecl);
139 if (suggestion != null) { 139 if (suggestion != null) {
140 request.addSuggestion(suggestion); 140 request.addSuggestion(suggestion);
(...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after
433 } 433 }
434 return new Future.value(false); 434 return new Future.value(false);
435 } 435 }
436 436
437 @override 437 @override
438 Future<bool> visitVariableElement(VariableElement element) { 438 Future<bool> visitVariableElement(VariableElement element) {
439 InterfaceTypeSuggestionBuilder.suggestionsFor(request, element.type); 439 InterfaceTypeSuggestionBuilder.suggestionsFor(request, element.type);
440 return new Future.value(true); 440 return new Future.value(true);
441 } 441 }
442 } 442 }
OLDNEW
« no previous file with comments | « no previous file | pkg/analysis_server/test/services/completion/completion_test_util.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698