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
5+ /// @docImport 'package:analyzer/dart/element/element2.dart';
6+ library ;
67
78import 'package:analyzer/dart/analysis/features.dart' ;
8- import 'package:analyzer/dart/element/element.dart' ;
99import 'package:analyzer/dart/element/nullability_suffix.dart' ;
1010import 'package:analyzer/dart/element/type.dart' ;
1111import 'package:analyzer/error/listener.dart' ;
@@ -21,13 +21,13 @@ import 'package:analyzer/src/utilities/extensions/element.dart';
2121
2222/// Information about a constructor element to instantiate.
2323///
24- /// If the target is a [ClassElement ] , the [element] is a raw
25- /// [ConstructorElement ] from the class, and [typeParameters] are the
24+ /// If the target is a [ClassElement2 ] , the [element] is a raw
25+ /// [ConstructorElement2 ] from the class, and [typeParameters] are the
2626/// type parameters of the class.
2727///
28- /// If the target is a [TypeAliasElement ] with an [InterfaceType] as the
28+ /// If the target is a [TypeAliasElement2 ] with an [InterfaceType] as the
2929/// aliased type, the [element] is a [ConstructorMember] created from the
30- /// [ConstructorElement ] of the corresponding class, and substituting
30+ /// [ConstructorElement2 ] of the corresponding class, and substituting
3131/// the class type parameters with the type arguments specified in the alias,
3232/// explicit types or the type parameters of the alias. The [typeParameters]
3333/// are the type parameters of the alias.
@@ -87,32 +87,32 @@ class InvocationInferenceHelper {
8787 /// return the element and type parameters to infer. Otherwise return `null` .
8888 ConstructorElementToInfer ? constructorElementToInfer ({
8989 required ConstructorName constructorName,
90- required LibraryElement definingLibrary,
90+ required LibraryElementImpl definingLibrary,
9191 }) {
92- List <TypeParameterElementImpl > typeParameters;
93- ConstructorElementMixin ? rawElement;
92+ List <TypeParameterElementImpl2 > typeParameters;
93+ ConstructorElementMixin2 ? rawElement;
9494
9595 var typeName = constructorName.type;
96- var typeElement = typeName.element;
97- if (typeElement is InterfaceElementImpl ) {
98- var augmented = typeElement.augmented ;
99- typeParameters = typeElement.typeParameters;
96+ var typeElement = typeName.element2;
97+ if (typeElement is InterfaceElementImpl2 ) {
98+ typeParameters = typeElement.typeParameters2;
10099 var constructorIdentifier = constructorName.name;
101100 if (constructorIdentifier == null ) {
102- rawElement = augmented .unnamedConstructor ;
101+ rawElement = typeElement.unnamedConstructor2 ;
103102 } else {
104103 var name = constructorIdentifier.name;
105- rawElement = augmented .getNamedConstructor (name);
106- if (rawElement != null && ! rawElement.isAccessibleIn (definingLibrary)) {
104+ rawElement = typeElement.getNamedConstructor2 (name);
105+ if (rawElement != null &&
106+ ! rawElement.isAccessibleIn2 (definingLibrary)) {
107107 rawElement = null ;
108108 }
109109 }
110- } else if (typeElement is TypeAliasElementImpl ) {
111- typeParameters = typeElement.typeParameters ;
110+ } else if (typeElement is TypeAliasElementImpl2 ) {
111+ typeParameters = typeElement.typeParameters2 ;
112112 var aliasedType = typeElement.aliasedType;
113113 if (aliasedType is InterfaceTypeImpl ) {
114114 var constructorIdentifier = constructorName.name;
115- rawElement = aliasedType.lookUpConstructor (
115+ rawElement = aliasedType.lookUpConstructor2 (
116116 constructorIdentifier? .name,
117117 definingLibrary,
118118 );
@@ -124,9 +124,7 @@ class InvocationInferenceHelper {
124124 if (rawElement == null ) {
125125 return null ;
126126 }
127- return ConstructorElementToInfer (
128- typeParameters.map ((e) => e.asElement2).toList (),
129- rawElement.asElement2);
127+ return ConstructorElementToInfer (typeParameters, rawElement);
130128 }
131129
132130 /// Given an uninstantiated generic function type, referenced by the
@@ -159,7 +157,7 @@ class InvocationInferenceHelper {
159157
160158 /// Finish resolution of the [MethodInvocation] .
161159 ///
162- /// We have already found the invoked [ExecutableElement ] , and the [rawType]
160+ /// We have already found the invoked [ExecutableElement2 ] , and the [rawType]
163161 /// is its not yet instantiated type. Here we perform downwards inference,
164162 /// resolution of arguments, and upwards inference.
165163 void resolveMethodInvocation ({
0 commit comments