Proposed AST interface for extension methods

Change-Id: I7c85a642eeaa862ecf9c6837c0a488938e8d97e9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/101225
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Mike Fairhurst <mfairhurst@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Dan Rubel <danrubel@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
diff --git a/pkg/analyzer/lib/dart/ast/ast.dart b/pkg/analyzer/lib/dart/ast/ast.dart
index 008e727..7667168 100644
--- a/pkg/analyzer/lib/dart/ast/ast.dart
+++ b/pkg/analyzer/lib/dart/ast/ast.dart
@@ -2108,6 +2108,37 @@
   void set superclass(TypeName name);
 }
 
+/// The declaration of an extension of a type.
+///
+///    extension ::=
+///        'extension' [SimpleIdentifier] [TypeParameterList]?
+///        'on' [TypeAnnotation] '{' [ClassMember]* '}'
+///
+/// Clients may not extend, implement or mix-in this class.
+abstract class ExtensionDeclaration implements NamedCompilationUnitMember {
+  /// Return the type that is being extended.
+  TypeAnnotation get extendedType;
+
+  /// Return the token representing the 'extension' keyword.
+  Token get extensionKeyword;
+
+  /// Return the left curly bracket.
+  Token get leftBracket;
+
+  /// Return the members being added to the extended class.
+  NodeList<ClassMember> get members;
+
+  /// Return the token representing the 'on' keyword.
+  Token get onKeyword;
+
+  /// Return the right curly bracket.
+  Token get rightBracket;
+
+  /// Return the type parameters for the extension, or `null` if the extension
+  /// does not have any type parameters.
+  TypeParameterList get typeParameters;
+}
+
 /// The declaration of one or more fields of the same type.
 ///
 ///    fieldDeclaration ::=