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

Unified Diff: pkg/analysis_server/lib/src/services/correction/fix_internal.dart

Issue 895773004: Issue 22316. Don't propose to create invalid local variable. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 years, 10 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | pkg/analysis_server/test/services/correction/fix_test.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/correction/fix_internal.dart
diff --git a/pkg/analysis_server/lib/src/services/correction/fix_internal.dart b/pkg/analysis_server/lib/src/services/correction/fix_internal.dart
index dbe4636640de26d28f1a6287cb0888a955c8853d..ff9dd933ed261065750f0e040bb8c51d8079f72a 100644
--- a/pkg/analysis_server/lib/src/services/correction/fix_internal.dart
+++ b/pkg/analysis_server/lib/src/services/correction/fix_internal.dart
@@ -835,8 +835,13 @@ class FixProcessor {
SourceBuilder sb = new SourceBuilder(file, target.offset);
{
// append type
- DartType fieldType = _inferUndefinedExpressionType(node);
- _appendType(sb, fieldType, groupId: 'TYPE', orVar: true);
+ DartType type = _inferUndefinedExpressionType(node);
+ if (!(type == null ||
+ type is InterfaceType ||
+ type is FunctionType && type.element != null && !type.element.isSynthetic)) {
+ return;
+ }
+ _appendType(sb, type, groupId: 'TYPE', orVar: true);
// append name
{
sb.startPosition('NAME');
« no previous file with comments | « no previous file | pkg/analysis_server/test/services/correction/fix_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698