diff --git a/pkg/analyzer/lib/src/dart/element/member.dart b/pkg/analyzer/lib/src/dart/element/member.dart index a9d6251d211e..57edf2ce88fb 100644 --- a/pkg/analyzer/lib/src/dart/element/member.dart +++ b/pkg/analyzer/lib/src/dart/element/member.dart @@ -1046,7 +1046,7 @@ class MethodMember extends ExecutableMember /// type parameters are known. class ParameterMember extends VariableMember with ParameterElementMixin - implements ParameterElement { + implements ParameterElement, FormalParameterElement { @override final List typeParameters; @@ -1076,9 +1076,16 @@ class ParameterMember extends VariableMember this.typeParameters, ); + @override + FormalParameterElement get baseElement => _element2; + @override List get children => parameters; + @override + List get children2 => + children.map((fragment) => fragment.asElement2).nonNulls.toList(); + @override ParameterElement get declaration => super.declaration as ParameterElement; @@ -1089,9 +1096,20 @@ class ParameterMember extends VariableMember // TODO(scheglov): we lose types FormalParameterElement get element => declaration.element; + @override + Element2? get enclosingElement2 => _element2.enclosingElement2; + @override Element? get enclosingElement3 => declaration.enclosingElement3; + @override + FormalParameterFragment get firstFragment => _element2.firstFragment; + + @override + // TODO(brianwilkerson): This loses type information. + List get formalParameters => + _element2.formalParameters; + @override bool get hasDefaultValue => declaration.hasDefaultValue; @@ -1104,9 +1122,18 @@ class ParameterMember extends VariableMember @override bool get isSuperFormal => declaration.isSuperFormal; + @override + LibraryElement2? get library2 => _element2.library2; + @override String get name => declaration.name; + @override + String? get name3 => _element2.name3; + + @override + Element2 get nonSynthetic2 => _element2; + @deprecated @override ParameterKind get parameterKind { @@ -1125,15 +1152,57 @@ class ParameterMember extends VariableMember @override Source? get source => _declaration.source; + @override + List get typeParameters2 => _element2.typeParameters2; + + FormalParameterElement get _element2 => + declaration.asElement2 as FormalParameterElement; + @override T? accept(ElementVisitor visitor) => visitor.visitParameterElement(this); + @override + T? accept2(ElementVisitor2 visitor) { + return visitor.visitFormalParameterElement(this); + } + @override void appendTo(ElementDisplayStringBuilder builder) { builder.writeFormalParameter(this); } + @override + void appendToWithoutDelimiters2(StringBuffer buffer) { + _element2.appendToWithoutDelimiters2(buffer); + } + + @override + String displayString2( + {bool multiline = false, bool preferTypeAlias = false}) { + return _element2.displayString2( + multiline: multiline, preferTypeAlias: preferTypeAlias); + } + + @override + bool isAccessibleIn2(LibraryElement2 library) => + _element2.isAccessibleIn2(library); + + @override + Element2? thisOrAncestorMatching2(bool Function(Element2 p1) predicate) { + return _element2.thisOrAncestorMatching2(predicate); + } + + @override + E? thisOrAncestorOfType2() { + return _element2.thisOrAncestorOfType2(); + } + + @override + void visitChildren2(ElementVisitor2 visitor) { + _element2.visitChildren2(visitor); + } + static ParameterElement from( ParameterElement element, MapSubstitution substitution) { var combined = substitution;