Use SUPER_AS_EXPRESSION for SuperAsIdentifier.

Change-Id: I7bcbcc51739f01532f4723cf39c25a620f77f8b0
Reviewed-on: https://dart-review.googlesource.com/71364
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
diff --git a/pkg/analyzer/test/generated/compile_time_error_code_kernel_test.dart b/pkg/analyzer/test/generated/compile_time_error_code_kernel_test.dart
index 2198b97..fe9840b 100644
--- a/pkg/analyzer/test/generated/compile_time_error_code_kernel_test.dart
+++ b/pkg/analyzer/test/generated/compile_time_error_code_kernel_test.dart
@@ -1189,53 +1189,17 @@
 
   @override
   @failingTest
-  test_superInInvalidContext_binaryExpression() async {
-    await super.test_superInInvalidContext_binaryExpression();
-  }
-
-  @override
-  @failingTest
   test_superInInvalidContext_constructorFieldInitializer() async {
     await super.test_superInInvalidContext_constructorFieldInitializer();
   }
 
   @override
   @failingTest
-  test_superInInvalidContext_factoryConstructor() async {
-    await super.test_superInInvalidContext_factoryConstructor();
-  }
-
-  @override
-  @failingTest
   test_superInInvalidContext_instanceVariableInitializer() async {
     await super.test_superInInvalidContext_instanceVariableInitializer();
   }
 
   @override
-  @failingTest
-  test_superInInvalidContext_staticMethod() async {
-    await super.test_superInInvalidContext_staticMethod();
-  }
-
-  @override
-  @failingTest
-  test_superInInvalidContext_staticVariableInitializer() async {
-    await super.test_superInInvalidContext_staticVariableInitializer();
-  }
-
-  @override
-  @failingTest
-  test_superInInvalidContext_topLevelFunction() async {
-    await super.test_superInInvalidContext_topLevelFunction();
-  }
-
-  @override
-  @failingTest
-  test_superInInvalidContext_topLevelVariableInitializer() async {
-    await super.test_superInInvalidContext_topLevelVariableInitializer();
-  }
-
-  @override
   @failingTest // Deliberately only reports one of the expected errors.
   test_superInRedirectingConstructor_superRedirection() async {
     await super.test_superInRedirectingConstructor_superRedirection();
diff --git a/pkg/analyzer/test/generated/compile_time_error_code_test.dart b/pkg/analyzer/test/generated/compile_time_error_code_test.dart
index 81013ce..27a8c27 100644
--- a/pkg/analyzer/test/generated/compile_time_error_code_test.dart
+++ b/pkg/analyzer/test/generated/compile_time_error_code_test.dart
@@ -7467,7 +7467,11 @@
   test_superInInvalidContext_binaryExpression() async {
     Source source = addSource("var v = super + 0;");
     await computeAnalysisResult(source);
-    assertErrors(source, [CompileTimeErrorCode.SUPER_IN_INVALID_CONTEXT]);
+    assertErrors(
+        source,
+        useCFE
+            ? [CompileTimeErrorCode.SUPER_AS_EXPRESSION]
+            : [CompileTimeErrorCode.SUPER_IN_INVALID_CONTEXT]);
     // no verify(), 'super.v' is not resolved
   }
 
@@ -7497,7 +7501,11 @@
   }
 }''');
     await computeAnalysisResult(source);
-    assertErrors(source, [CompileTimeErrorCode.SUPER_IN_INVALID_CONTEXT]);
+    assertErrors(
+        source,
+        useCFE
+            ? [CompileTimeErrorCode.SUPER_AS_EXPRESSION]
+            : [CompileTimeErrorCode.SUPER_IN_INVALID_CONTEXT]);
     // no verify(), 'super.m' is not resolved
   }
 
@@ -7523,7 +7531,11 @@
   static n() { return super.m(); }
 }''');
     await computeAnalysisResult(source);
-    assertErrors(source, [CompileTimeErrorCode.SUPER_IN_INVALID_CONTEXT]);
+    assertErrors(
+        source,
+        useCFE
+            ? [CompileTimeErrorCode.SUPER_AS_EXPRESSION]
+            : [CompileTimeErrorCode.SUPER_IN_INVALID_CONTEXT]);
     // no verify(), 'super.m' is not resolved
   }
 
@@ -7536,7 +7548,11 @@
   static int b = super.a;
 }''');
     await computeAnalysisResult(source);
-    assertErrors(source, [CompileTimeErrorCode.SUPER_IN_INVALID_CONTEXT]);
+    assertErrors(
+        source,
+        useCFE
+            ? [CompileTimeErrorCode.SUPER_AS_EXPRESSION]
+            : [CompileTimeErrorCode.SUPER_IN_INVALID_CONTEXT]);
     // no verify(), 'super.a' is not resolved
   }
 
@@ -7546,14 +7562,22 @@
   super.f();
 }''');
     await computeAnalysisResult(source);
-    assertErrors(source, [CompileTimeErrorCode.SUPER_IN_INVALID_CONTEXT]);
+    assertErrors(
+        source,
+        useCFE
+            ? [CompileTimeErrorCode.SUPER_AS_EXPRESSION]
+            : [CompileTimeErrorCode.SUPER_IN_INVALID_CONTEXT]);
     // no verify(), 'super.f' is not resolved
   }
 
   test_superInInvalidContext_topLevelVariableInitializer() async {
     Source source = addSource("var v = super.y;");
     await computeAnalysisResult(source);
-    assertErrors(source, [CompileTimeErrorCode.SUPER_IN_INVALID_CONTEXT]);
+    assertErrors(
+        source,
+        useCFE
+            ? [CompileTimeErrorCode.SUPER_AS_EXPRESSION]
+            : [CompileTimeErrorCode.SUPER_IN_INVALID_CONTEXT]);
     // no verify(), 'super.y' is not resolved
   }
 
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 f806a2a..d46ccad 100644
--- a/pkg/front_end/lib/src/fasta/fasta_codes_generated.dart
+++ b/pkg/front_end/lib/src/fasta/fasta_codes_generated.dart
@@ -6640,6 +6640,8 @@
 // DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
 const MessageCode messageSuperAsIdentifier = const MessageCode(
     "SuperAsIdentifier",
+    analyzerCode: "SUPER_AS_EXPRESSION",
+    dart2jsCode: "*fatal*",
     message: r"""Expected identifier, but got 'super'.""");
 
 // DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
diff --git a/pkg/front_end/messages.status b/pkg/front_end/messages.status
index 7287490..0c946ee 100644
--- a/pkg/front_end/messages.status
+++ b/pkg/front_end/messages.status
@@ -324,7 +324,6 @@
 StackOverflow/example: Fail
 StaticAfterConst/script1: Fail
 SuperAsExpression/example: Fail
-SuperAsIdentifier/analyzerCode: Fail
 SuperAsIdentifier/example: Fail
 SuperNullAware/example: Fail
 SuperclassHasNoDefaultConstructor/example: Fail
diff --git a/pkg/front_end/messages.yaml b/pkg/front_end/messages.yaml
index 21649bf..97c4778 100644
--- a/pkg/front_end/messages.yaml
+++ b/pkg/front_end/messages.yaml
@@ -2362,6 +2362,8 @@
 
 SuperAsIdentifier:
   template: "Expected identifier, but got 'super'."
+  analyzerCode: SUPER_AS_EXPRESSION
+  dart2jsCode: "*fatal*"
 
 SuperAsExpression:
   template: "Can't use 'super' as an expression."