Remove deprecated DocDirectiveType example and hideConstantImplementations.

Theoretically this would be a breaking change, but I see that we
marked DocDirectiveType as experimental, so we can remove them as long
as it is not de-facto breaking.

Change-Id: I88ccb739304870dad9a7dd040e4ebd320af6bb1b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/383446
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
diff --git a/pkg/analyzer/lib/dart/ast/doc_comment.dart b/pkg/analyzer/lib/dart/ast/doc_comment.dart
index cdd3539..e923191 100644
--- a/pkg/analyzer/lib/dart/ast/doc_comment.dart
+++ b/pkg/analyzer/lib/dart/ast/doc_comment.dart
@@ -247,34 +247,6 @@
   /// are included. This also allows us to parse (erroneous) dangling end tags.
   endTemplate.end('endtemplate', openingTag: 'template'),
 
-  /// A [DocDirective] declaring an example file.
-  ///
-  /// This directive has one required argument: the path. A named 'region'
-  /// argument, and a named 'lang' argument can also be given. For example:
-  ///
-  /// ```none
-  /// {@example abc/def/xyz_component.dart region=template lang=html}
-  /// ```
-  ///
-  /// See documentation at
-  /// <https://github.com/dart-lang/dartdoc/blob/main/doc/directives.md#example---examples-deprecated>.
-  @Deprecated('Recognition of this directive is deprecated in dartdoc')
-  example(
-    'example',
-    positionalParameters: [
-      DocDirectiveParameter('path', DocDirectiveParameterFormat.any)
-    ],
-    namedParameters: [
-      DocDirectiveParameter('region', DocDirectiveParameterFormat.any),
-      DocDirectiveParameter('lang', DocDirectiveParameterFormat.any),
-    ],
-  ),
-
-  /// A [DocDirective] indicating that constants should not have their own
-  /// pages or implementations displayed.
-  @Deprecated('Recognition of this directive is removed in dartdoc')
-  hideConstantImplementations('hideConstantImplementations'),
-
   /// A [DocDirective] declaring a block of HTML content which is to be inserted
   /// after all other processing, including Markdown parsing.
   ///
diff --git a/pkg/analyzer/lib/src/fasta/doc_comment_builder.dart b/pkg/analyzer/lib/src/fasta/doc_comment_builder.dart
index ac320ca..0f87f94 100644
--- a/pkg/analyzer/lib/src/fasta/doc_comment_builder.dart
+++ b/pkg/analyzer/lib/src/fasta/doc_comment_builder.dart
@@ -362,15 +362,6 @@
       case 'endtemplate':
         _endBlockDocDirectiveTag(parser, DocDirectiveType.endTemplate);
         return true;
-      case 'example':
-        // ignore: deprecated_member_use_from_same_package
-        _pushDocDirective(parser.simpleDirective(DocDirectiveType.example));
-        return true;
-      case 'hideConstantImplementations':
-        _pushDocDirective(parser
-            // ignore: deprecated_member_use_from_same_package
-            .simpleDirective(DocDirectiveType.hideConstantImplementations));
-        return true;
       case 'inject-html':
         _parseBlockDocDirectiveTag(parser, DocDirectiveType.injectHtml);
         return true;
diff --git a/pkg/analyzer/test/src/dart/parser/doc_comment_test.dart b/pkg/analyzer/test/src/dart/parser/doc_comment_test.dart
index 1ed3b8c..6125c69 100644
--- a/pkg/analyzer/test/src/dart/parser/doc_comment_test.dart
+++ b/pkg/analyzer/test/src/dart/parser/doc_comment_test.dart
@@ -1142,30 +1142,6 @@
 ''');
   }
 
-  test_hideConstantImplementations() {
-    var parseResult = parseStringWithErrors(r'''
-int x = 0;
-
-/// Text.
-/// {@hideConstantImplementations}
-class A {}
-''');
-    parseResult.assertNoErrors();
-
-    var node = parseResult.findNode.comment('hideConstantImplementations');
-    assertParsedNodeText(node, r'''
-Comment
-  tokens
-    /// Text.
-    /// {@hideConstantImplementations}
-  docDirectives
-    SimpleDocDirective
-      tag
-        offset: [26, 57]
-        type: [DocDirectiveType.hideConstantImplementations]
-''');
-  }
-
   test_indentedCodeBlock_afterBlankLine() {
     var parseResult = parseStringWithErrors(r'''
 /// Text.
@@ -1509,7 +1485,7 @@
 /// Text.
 /// {@template name}
 /// More text.
-/// {@example path}
+/// {@macro name}
 /// {@endtemplate}
 class A {}
 ''');
@@ -1522,7 +1498,7 @@
     /// Text.
     /// {@template name}
     /// More text.
-    /// {@example path}
+    /// {@macro name}
     /// {@endtemplate}
   docDirectives
     BlockDocDirective
@@ -1532,14 +1508,14 @@
         positionalArguments
           name
       closingTag
-        offset: [82, 97]
+        offset: [80, 95]
         type: [DocDirectiveType.endTemplate]
     SimpleDocDirective
       tag
-        offset: [62, 78]
-        type: [DocDirectiveType.example]
+        offset: [62, 76]
+        type: [DocDirectiveType.macro]
         positionalArguments
-          path
+          name
 ''');
   }
 
diff --git a/pkg/analyzer/test/src/diagnostics/doc_directive_has_extra_arguments_test.dart b/pkg/analyzer/test/src/diagnostics/doc_directive_has_extra_arguments_test.dart
index 2cfac36..820eaaa 100644
--- a/pkg/analyzer/test/src/diagnostics/doc_directive_has_extra_arguments_test.dart
+++ b/pkg/analyzer/test/src/diagnostics/doc_directive_has_extra_arguments_test.dart
@@ -38,12 +38,12 @@
 ''');
   }
 
-  test_example_hasExtraArgument() async {
+  test_macro_hasExtraArgument() async {
     await assertErrorsInCode('''
-/// {@example one two}
+/// {@macro one two}
 class C {}
 ''', [
-      error(WarningCode.DOC_DIRECTIVE_HAS_EXTRA_ARGUMENTS, 18, 3),
+      error(WarningCode.DOC_DIRECTIVE_HAS_EXTRA_ARGUMENTS, 16, 3),
     ]);
   }
 
diff --git a/pkg/analyzer/test/src/diagnostics/doc_directive_has_unexpected_named_argument_test.dart b/pkg/analyzer/test/src/diagnostics/doc_directive_has_unexpected_named_argument_test.dart
index 0d0b6b8..1e81275 100644
--- a/pkg/analyzer/test/src/diagnostics/doc_directive_has_unexpected_named_argument_test.dart
+++ b/pkg/analyzer/test/src/diagnostics/doc_directive_has_unexpected_named_argument_test.dart
@@ -25,18 +25,18 @@
     ]);
   }
 
-  test_example_hasExtraArgument() async {
+  test_macro_hasExtraArgument() async {
     await assertErrorsInCode('''
-/// {@example path foo=bar}
+/// {@macro name foo=bar}
 class C {}
 ''', [
-      error(WarningCode.DOC_DIRECTIVE_HAS_UNEXPECTED_NAMED_ARGUMENT, 19, 7),
+      error(WarningCode.DOC_DIRECTIVE_HAS_UNEXPECTED_NAMED_ARGUMENT, 17, 7),
     ]);
   }
 
-  test_example_noExtraArgument() async {
+  test_macro_noExtraArgument() async {
     await assertNoErrorsInCode('''
-/// {@example path}
+/// {@macro name}
 class C {}
 ''');
   }
diff --git a/pkg/analyzer/test/src/diagnostics/doc_directive_missing_one_argument_test.dart b/pkg/analyzer/test/src/diagnostics/doc_directive_missing_one_argument_test.dart
index bbc8bea..a5e5fe1 100644
--- a/pkg/analyzer/test/src/diagnostics/doc_directive_missing_one_argument_test.dart
+++ b/pkg/analyzer/test/src/diagnostics/doc_directive_missing_one_argument_test.dart
@@ -45,12 +45,12 @@
 ''');
   }
 
-  test_example_hasNoArguments() async {
+  test_macro_hasNoArguments() async {
     await assertErrorsInCode('''
-/// {@example}
+/// {@macro}
 class C {}
 ''', [
-      error(WarningCode.DOC_DIRECTIVE_MISSING_ONE_ARGUMENT, 4, 11),
+      error(WarningCode.DOC_DIRECTIVE_MISSING_ONE_ARGUMENT, 4, 9),
     ]);
   }