Convert Unspecified to ConstructorNotSync

Change-Id: Iabfad9797912fdb13dc86c22de6593d2c51b6716
Reviewed-on: https://dart-review.googlesource.com/64923
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
diff --git a/pkg/analyzer/lib/error/error.dart b/pkg/analyzer/lib/error/error.dart
index 9169f94..8884134 100644
--- a/pkg/analyzer/lib/error/error.dart
+++ b/pkg/analyzer/lib/error/error.dart
@@ -211,7 +211,8 @@
   CompileTimeErrorCode.NON_CONST_MAP_AS_EXPRESSION_STATEMENT,
   CompileTimeErrorCode.NON_GENERATIVE_CONSTRUCTOR,
   CompileTimeErrorCode.NON_SYNC_ABSTRACT_METHOD,
-  CompileTimeErrorCode.NON_SYNC_FACTORY_METHOD,
+  CompileTimeErrorCode.NON_SYNC_CONSTRUCTOR,
+  CompileTimeErrorCode.NON_SYNC_FACTORY,
   CompileTimeErrorCode.NOT_CONSTANT_EXPRESSION,
   CompileTimeErrorCode.NOT_ENOUGH_REQUIRED_ARGUMENTS,
   CompileTimeErrorCode.NO_ANNOTATION_CONSTRUCTOR_ARGUMENTS,
diff --git a/pkg/analyzer/lib/src/error/codes.dart b/pkg/analyzer/lib/src/error/codes.dart
index ae112f2..d7c20b3 100644
--- a/pkg/analyzer/lib/src/error/codes.dart
+++ b/pkg/analyzer/lib/src/error/codes.dart
@@ -2051,8 +2051,11 @@
   static const CompileTimeErrorCode NON_SYNC_ABSTRACT_METHOD =
       const CompileTimeErrorCode.fromFasta('NON_SYNC_ABSTRACT_METHOD');
 
-  static const CompileTimeErrorCode NON_SYNC_FACTORY_METHOD =
-      const CompileTimeErrorCode.fromFasta('NON_SYNC_FACTORY_METHOD');
+  static const CompileTimeErrorCode NON_SYNC_CONSTRUCTOR =
+      const CompileTimeErrorCode.fromFasta('NON_SYNC_CONSTRUCTOR');
+
+  static const CompileTimeErrorCode NON_SYNC_FACTORY =
+      const CompileTimeErrorCode.fromFasta('NON_SYNC_FACTORY');
 
   /**
    * 12.14.2 Binding Actuals to Formals: It is a static warning if <i>m < h</i>
diff --git a/pkg/front_end/lib/src/fasta/fasta_codes_generated.dart b/pkg/front_end/lib/src/fasta/fasta_codes_generated.dart
index 0e50714..03da49d 100644
--- a/pkg/front_end/lib/src/fasta/fasta_codes_generated.dart
+++ b/pkg/front_end/lib/src/fasta/fasta_codes_generated.dart
@@ -1335,6 +1335,17 @@
 }
 
 // DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
+const Code<Null> codeConstructorNotSync = messageConstructorNotSync;
+
+// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
+const MessageCode messageConstructorNotSync = const MessageCode(
+    "ConstructorNotSync",
+    analyzerCode: "NON_SYNC_CONSTRUCTOR",
+    dart2jsCode: "*ignored*",
+    message:
+        r"""Constructor bodies can't use 'async', 'async*', or 'sync*'.""");
+
+// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
 const Code<Null> codeConstructorWithReturnType =
     messageConstructorWithReturnType;
 
@@ -2675,9 +2686,9 @@
 
 // DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
 const MessageCode messageFactoryNotSync = const MessageCode("FactoryNotSync",
-    analyzerCode: "NON_SYNC_FACTORY_METHOD",
+    analyzerCode: "NON_SYNC_FACTORY",
     dart2jsCode: "*ignored*",
-    message: r"""Factories can't use 'async', 'async*', or 'sync*'.""");
+    message: r"""Factory bodies can't use 'async', 'async*', or 'sync*'.""");
 
 // DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
 const Code<Null> codeFactoryTopLevelDeclaration =
diff --git a/pkg/front_end/lib/src/fasta/kernel/body_builder.dart b/pkg/front_end/lib/src/fasta/kernel/body_builder.dart
index f84c0a6..3838ba4 100644
--- a/pkg/front_end/lib/src/fasta/kernel/body_builder.dart
+++ b/pkg/front_end/lib/src/fasta/kernel/body_builder.dart
@@ -933,7 +933,7 @@
       int offset = builder.body?.fileOffset ?? builder.charOffset;
       constructor.initializers.add(buildInvalidInitializer(
           deprecated_buildCompileTimeError(
-              "A constructor can't be '${asyncModifier}'.", offset),
+              null, offset, fasta.messageConstructorNotSync),
           offset));
     }
     if (needsImplicitSuperInitializer) {
diff --git a/pkg/front_end/messages.status b/pkg/front_end/messages.status
index a9a5a52..99af76f 100644
--- a/pkg/front_end/messages.status
+++ b/pkg/front_end/messages.status
@@ -83,6 +83,7 @@
 ConstFieldWithoutInitializer/example: Fail
 ConstructorNotFound/analyzerCode: Fail
 ConstructorNotFound/example: Fail
+ConstructorNotSync/example: Fail
 ContinueOutsideOfLoop/script1: Fail
 ContinueWithoutLabelInCase/script1: Fail
 CouldNotParseUri/analyzerCode: Fail
diff --git a/pkg/front_end/messages.yaml b/pkg/front_end/messages.yaml
index 81817dc..9d81316 100644
--- a/pkg/front_end/messages.yaml
+++ b/pkg/front_end/messages.yaml
@@ -960,9 +960,14 @@
       await for (var e in o) {}
     }
 
+ConstructorNotSync:
+  template: "Constructor bodies can't use 'async', 'async*', or 'sync*'."
+  analyzerCode: NON_SYNC_CONSTRUCTOR
+  dart2jsCode: "*ignored*"
+
 FactoryNotSync:
-  template: "Factories can't use 'async', 'async*', or 'sync*'."
-  analyzerCode: NON_SYNC_FACTORY_METHOD
+  template: "Factory bodies can't use 'async', 'async*', or 'sync*'."
+  analyzerCode: NON_SYNC_FACTORY
   dart2jsCode: "*ignored*"
 
 GeneratorReturnsValue: