| 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 a33d280fe75cd346087c593f82cef1cadc3ab2d0..3fdd5f9a3db8a3b7a43e2afc1012365455acbf5e 100644
|
| --- a/pkg/analysis_server/lib/src/services/correction/fix_internal.dart
|
| +++ b/pkg/analysis_server/lib/src/services/correction/fix_internal.dart
|
| @@ -700,10 +700,14 @@ class FixProcessor {
|
| return;
|
| }
|
| ClassElement targetElement = constructorElement.enclosingElement;
|
| - String targetFile = targetElement.source.fullName;
|
| - ClassDeclaration targetClass = getParsedClassElementNode(targetElement);
|
| + // prepare location for a new constructor
|
| + AstNode targetTypeNode = getParsedClassElementNode(targetElement);
|
| + if (targetTypeNode is! ClassDeclaration) {
|
| + return;
|
| + }
|
| _ConstructorLocation targetLocation =
|
| - _prepareNewConstructorLocation(targetClass);
|
| + _prepareNewConstructorLocation(targetTypeNode);
|
| + String targetFile = targetElement.source.fullName;
|
| // build method source
|
| SourceBuilder sb = new SourceBuilder(targetFile, targetLocation.offset);
|
| {
|
| @@ -753,11 +757,15 @@ class FixProcessor {
|
| if (targetType is! InterfaceType) {
|
| return;
|
| }
|
| + // prepare location for a new constructor
|
| ClassElement targetElement = targetType.element as ClassElement;
|
| - String targetFile = targetElement.source.fullName;
|
| - ClassDeclaration targetClass = getParsedClassElementNode(targetElement);
|
| + AstNode targetTypeNode = getParsedClassElementNode(targetElement);
|
| + if (targetTypeNode is! ClassDeclaration) {
|
| + return;
|
| + }
|
| _ConstructorLocation targetLocation =
|
| - _prepareNewConstructorLocation(targetClass);
|
| + _prepareNewConstructorLocation(targetTypeNode);
|
| + String targetFile = targetElement.source.fullName;
|
| // build method source
|
| SourceBuilder sb = new SourceBuilder(targetFile, targetLocation.offset);
|
| {
|
|
|