| 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 c2dfd1b7e23ed19bf6f355a9a6f0c61fd7fe79d3..1052c9dd0740725d1b136339385a4de8700467cb 100644
|
| --- a/pkg/analysis_server/lib/src/services/correction/fix_internal.dart
|
| +++ b/pkg/analysis_server/lib/src/services/correction/fix_internal.dart
|
| @@ -348,6 +348,9 @@ class FixProcessor {
|
| await _addFix_importLibrary_withTopLevelVariable();
|
| await _addFix_createLocalVariable();
|
| }
|
| + if (errorCode == StaticTypeWarningCode.UNDEFINED_METHOD_WITH_CONSTRUCTOR) {
|
| + await _addFix_undefinedMethodWithContructor();
|
| + }
|
| if (errorCode == StaticTypeWarningCode.ILLEGAL_ASYNC_RETURN_TYPE) {
|
| await _addFix_illegalAsyncReturnType();
|
| }
|
| @@ -2522,6 +2525,20 @@ class FixProcessor {
|
| }
|
| }
|
|
|
| + Future<Null> _addFix_undefinedMethodWithContructor() async {
|
| + if (node is SimpleIdentifier && node.parent is MethodInvocation) {
|
| + DartChangeBuilder changeBuilder = new DartChangeBuilder(session);
|
| + await changeBuilder.addFileEdit(file, (DartFileEditBuilder builder) {
|
| + builder.addSimpleInsertion(node.parent.offset, 'new ');
|
| + });
|
| + _addFixFromBuilder(
|
| + changeBuilder, DartFixKind.INVOKE_CONSTRUCTOR_USING_NEW);
|
| + // TODO(brianwilkerson) Figure out whether the constructor is a `const`
|
| + // constructor and all of the parameters are constant expressions, and
|
| + // suggest inserting 'const ' if so.
|
| + }
|
| + }
|
| +
|
| /**
|
| * Here we handle cases when a constructors does not initialize all of the
|
| * final fields.
|
|
|