22// for details. All rights reserved. Use of this source code is governed by a
33// BSD-style license that can be found in the LICENSE file.
44
5- // ignore_for_file: analyzer_use_new_elements
6-
75import 'package:_fe_analyzer_shared/src/type_inference/type_analyzer_operations.dart' ;
86import 'package:analyzer/dart/element/type.dart' ;
97import 'package:analyzer/src/dart/element/element.dart' ;
@@ -42,7 +40,7 @@ class ReplaceTopBottomVisitor {
4240 var alias = type.alias;
4341 if (alias != null ) {
4442 return _instantiatedTypeAlias (type, alias, variance);
45- } else if (type is InterfaceType ) {
43+ } else if (type is InterfaceTypeImpl ) {
4644 return _interfaceType (type, variance);
4745 } else if (type is FunctionType ) {
4846 return _functionType (type, variance);
@@ -53,7 +51,7 @@ class ReplaceTopBottomVisitor {
5351 DartType _functionType (FunctionType type, Variance variance) {
5452 var newReturnType = process (type.returnType, variance);
5553
56- var newParameters = type.parameters .map ((parameter) {
54+ var newParameters = type.formalParameters .map ((parameter) {
5755 return parameter.copyWith (
5856 type: process (
5957 parameter.type,
@@ -62,9 +60,9 @@ class ReplaceTopBottomVisitor {
6260 );
6361 }).toList ();
6462
65- return FunctionTypeImpl (
66- typeFormals : type.typeFormals ,
67- parameters : newParameters,
63+ return FunctionTypeImpl . v2 (
64+ typeParameters : type.typeParameters ,
65+ formalParameters : newParameters,
6866 returnType: newReturnType,
6967 nullabilitySuffix: type.nullabilitySuffix,
7068 );
@@ -75,15 +73,15 @@ class ReplaceTopBottomVisitor {
7573 InstantiatedTypeAliasElement alias,
7674 Variance variance,
7775 ) {
78- var aliasElement = alias.element ;
76+ var aliasElement = alias.element2 ;
7977 var aliasArguments = alias.typeArguments;
8078
81- var typeParameters = aliasElement.typeParameters ;
79+ var typeParameters = aliasElement.typeParameters2 ;
8280 assert (typeParameters.length == aliasArguments.length);
8381
8482 var newTypeArguments = < DartType > [];
8583 for (var i = 0 ; i < typeParameters.length; i++ ) {
86- var typeParameter = typeParameters[i] as TypeParameterElementImpl ;
84+ var typeParameter = typeParameters[i] as TypeParameterElementImpl2 ;
8785 newTypeArguments.add (
8886 process (
8987 aliasArguments[i],
@@ -98,8 +96,8 @@ class ReplaceTopBottomVisitor {
9896 );
9997 }
10098
101- DartType _interfaceType (InterfaceType type, Variance variance) {
102- var typeParameters = type.element.typeParameters ;
99+ InterfaceTypeImpl _interfaceType (InterfaceTypeImpl type, Variance variance) {
100+ var typeParameters = type.element3.typeParameters2 ;
103101 if (typeParameters.isEmpty) {
104102 return type;
105103 }
@@ -113,8 +111,8 @@ class ReplaceTopBottomVisitor {
113111 newTypeArguments.add (newTypeArgument);
114112 }
115113
116- return InterfaceTypeImpl (
117- element: type.element ,
114+ return InterfaceTypeImpl . v2 (
115+ element: type.element3 ,
118116 nullabilitySuffix: type.nullabilitySuffix,
119117 typeArguments: newTypeArguments,
120118 );
0 commit comments