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

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

Issue 1053723002: Fix a null-pointer reference and minor clean-up (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Added tests 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 bd6c42af7f25841d4c35096e087e3c1bbc5d0d0f..f38c00c92d3c603b522e6ac4b9690a9a63bcbdd4 100644
--- a/pkg/analysis_server/lib/src/services/correction/fix_internal.dart
+++ b/pkg/analysis_server/lib/src/services/correction/fix_internal.dart
@@ -376,6 +376,9 @@ class FixProcessor {
}
ClassDeclaration classDeclaration =
node.getAncestor((node) => node is ClassDeclaration);
+ if (classDeclaration == null) {
+ return;
+ }
// prepare names of uninitialized final fields
List<String> fieldNames = <String>[];
for (ClassMember member in classDeclaration.members) {
@@ -2396,9 +2399,8 @@ class FixProcessor {
static void _addSuperTypeProposals(
SourceBuilder sb, Set<DartType> alreadyAdded, DartType type) {
if (type != null &&
- !alreadyAdded.contains(type) &&
- type.element is ClassElement) {
- alreadyAdded.add(type);
+ type.element is ClassElement &&
+ alreadyAdded.add(type)) {
ClassElement element = type.element as ClassElement;
sb.addSuggestion(LinkedEditSuggestionKind.TYPE, element.name);
_addSuperTypeProposals(sb, alreadyAdded, element.supertype);
« 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