@@ -2,7 +2,7 @@ import 'dart:async';
22import 'dart:convert' ;
33
44import 'package:analyzer/dart/constant/value.dart' ;
5- import 'package:analyzer/dart/element/element2 .dart' ;
5+ import 'package:analyzer/dart/element/element .dart' ;
66import 'package:analyzer/dart/element/type.dart' ;
77import 'package:build/build.dart' ;
88import 'package:catalyst_builder_contracts/catalyst_builder_contracts.dart' ;
@@ -26,7 +26,7 @@ class PreflightBuilder implements Builder {
2626 return ;
2727 }
2828
29- LibraryElement2 libraryElement;
29+ LibraryElement libraryElement;
3030 try {
3131 libraryElement = await buildStep.inputLibrary;
3232 } catch (e) {
@@ -45,29 +45,29 @@ class PreflightBuilder implements Builder {
4545 );
4646 }
4747
48- PreflightPart _extractAnnotations (LibraryElement2 entryLib) {
48+ PreflightPart _extractAnnotations (LibraryElement entryLib) {
4949 var services = < ExtractedService > [];
5050
51- for (var lib in entryLib.children2 .whereType <Annotatable >()) {
51+ for (var lib in entryLib.children .whereType <Element >()) {
5252 services.addAll (_extractFromTopLevelElement (lib));
5353 }
5454
5555 return PreflightPart (services: services);
5656 }
5757
58- List <ExtractedService > _extractFromTopLevelElement (Annotatable el) {
58+ List <ExtractedService > _extractFromTopLevelElement (Element el) {
5959 var services = < ExtractedService > [];
60- var isPreloaded = el.metadata2 .annotations.any (
60+ var isPreloaded = el.metadata .annotations.any (
6161 (a) => a.isLibraryAnnotation ('Preload' ),
6262 );
6363
64- for (var annotation in el.metadata2 .annotations) {
64+ for (var annotation in el.metadata .annotations) {
6565 if (annotation.isLibraryAnnotation ('ServiceMap' )) {
6666 services.addAll (
6767 _extractServicesFromServiceMap (annotation, isPreloaded),
6868 );
6969 }
70- if (annotation.isLibraryAnnotation ('Service' ) && el is ClassElement2 ) {
70+ if (annotation.isLibraryAnnotation ('Service' ) && el is ClassElement ) {
7171 var serviceAnnotation = annotation.computeConstantValue ();
7272 services.add (
7373 _mapToExtractedService (el, serviceAnnotation, isPreloaded),
@@ -91,8 +91,8 @@ class PreflightBuilder implements Builder {
9191 continue ;
9292 }
9393
94- var keyElement = typed.element3 ;
95- if (keyElement is ! ClassElement2 ) {
94+ var keyElement = typed.element ;
95+ if (keyElement is ! ClassElement ) {
9696 continue ;
9797 }
9898
@@ -104,7 +104,7 @@ class PreflightBuilder implements Builder {
104104 }
105105
106106 ExtractedService _mapToExtractedService (
107- ClassElement2 serviceClass,
107+ ClassElement serviceClass,
108108 DartObject ? serviceAnnotation,
109109 bool isPreloaded,
110110 ) {
@@ -114,7 +114,7 @@ class PreflightBuilder implements Builder {
114114 lifetime: lifetime.toString (),
115115 service: SymbolReference (
116116 symbolName: serviceClass.displayName,
117- library: serviceClass.library2 .uri.toString (),
117+ library: serviceClass.library .uri.toString (),
118118 ),
119119 constructorArgs: _extractConstructorArgs (serviceClass),
120120 exposeAs: _getExposeAs (serviceAnnotation),
@@ -129,11 +129,11 @@ class PreflightBuilder implements Builder {
129129 return null ;
130130 }
131131
132- var exposeAsElement = typed.element3 ;
132+ var exposeAsElement = typed.element ;
133133
134134 return SymbolReference (
135135 symbolName: exposeAsElement.displayName,
136- library: exposeAsElement.library2 .uri.toString (),
136+ library: exposeAsElement.library .uri.toString (),
137137 );
138138 }
139139
@@ -145,14 +145,14 @@ class PreflightBuilder implements Builder {
145145 return ServiceLifetime .values[lifetimeIndex ?? 1 ];
146146 }
147147
148- List <ConstructorArg > _extractConstructorArgs (ClassElement2 el) {
149- var constructors = el.children2
150- .whereType <ConstructorElement2 >()
148+ List <ConstructorArg > _extractConstructorArgs (ClassElement el) {
149+ var constructors = el.children
150+ .whereType <ConstructorElement >()
151151 .where (
152152 (ctor) =>
153153 ! ctor.isFactory &&
154- (ctor.firstFragment.name2 == '' ||
155- ctor.firstFragment.name2 == 'new' ),
154+ (ctor.firstFragment.name == '' ||
155+ ctor.firstFragment.name == 'new' ),
156156 )
157157 .toList ();
158158 return constructors.firstOrNull? .formalParameters
@@ -162,7 +162,7 @@ class PreflightBuilder implements Builder {
162162 }
163163
164164 ConstructorArg _buildConstructorArg (FormalParameterElement param) {
165- var annotations = param.metadata2 .annotations;
165+ var annotations = param.metadata .annotations;
166166
167167 return ConstructorArg (
168168 name: param.displayName,
0 commit comments