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

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

Issue 1013303002: Fix for NPE in the field creation Quick Fix. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 years, 9 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 a629ad52eb6f0fadb2971edef5a8e6a08d5a9f43..ae697914485764c60eb9dae7eb814f5a08625423 100644
--- a/pkg/analysis_server/lib/src/services/correction/fix_internal.dart
+++ b/pkg/analysis_server/lib/src/services/correction/fix_internal.dart
@@ -736,8 +736,13 @@ class FixProcessor {
staticModifier = _inStaticContext();
}
utils.targetClassElement = targetClassElement;
+ // prepare target ClassDeclaration
+ AstNode targetTypeNode = targetClassElement.node;
+ if (targetTypeNode is! ClassDeclaration) {
+ return;
+ }
+ ClassDeclaration targetClassNode = targetTypeNode;
// prepare location
- ClassDeclaration targetClassNode = targetClassElement.node;
_FieldLocation targetLocation = _prepareNewFieldLocation(targetClassNode);
// build method source
String targetFile = targetClassElement.source.fullName;
@@ -861,8 +866,13 @@ class FixProcessor {
staticModifier = _inStaticContext();
}
utils.targetClassElement = targetClassElement;
+ // prepare target ClassDeclaration
+ AstNode targetTypeNode = targetClassElement.node;
+ if (targetTypeNode is! ClassDeclaration) {
+ return;
+ }
+ ClassDeclaration targetClassNode = targetTypeNode;
// prepare location
- ClassDeclaration targetClassNode = targetClassElement.node;
_FieldLocation targetLocation = _prepareNewGetterLocation(targetClassNode);
// build method source
String targetFile = targetClassElement.source.fullName;
« 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