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 'dart:typed_data' ;
86
97import 'package:analyzer/dart/ast/token.dart' ;
@@ -178,14 +176,13 @@ class InformativeDataApplier {
178176 }
179177
180178 void _applyToAccessors (
181- List <PropertyAccessorElement > elementList,
179+ List <PropertyAccessorElementImpl > elementList,
182180 List <_InfoMethodDeclaration > infoList,
183181 ) {
184- forCorrespondingPairs < PropertyAccessorElement , _InfoMethodDeclaration > (
182+ forCorrespondingPairs (
185183 elementList.notSynthetic,
186184 infoList,
187185 (element, info) {
188- element as PropertyAccessorElementImpl ;
189186 element.setCodeRange (info.codeOffset, info.codeLength);
190187 element.nameOffset = info.nameOffset;
191188 element.nameOffset2 = info.nameOffset2;
@@ -215,10 +212,9 @@ class InformativeDataApplier {
215212 }
216213
217214 void _applyToClassDeclaration (
218- ClassElement element,
215+ ClassElementImpl element,
219216 _InfoClassDeclaration info,
220217 ) {
221- element as ClassElementImpl ;
222218 element.setCodeRange (info.codeOffset, info.codeLength);
223219 element.nameOffset = info.nameOffset;
224220 element.nameOffset2 = info.nameOffset2;
@@ -254,10 +250,9 @@ class InformativeDataApplier {
254250 }
255251
256252 void _applyToClassTypeAlias (
257- ClassElement element,
253+ ClassElementImpl element,
258254 _InfoClassTypeAlias info,
259255 ) {
260- element as ClassElementImpl ;
261256 element.setCodeRange (info.codeOffset, info.codeLength);
262257 element.nameOffset = info.nameOffset;
263258 element.nameOffset2 = info.nameOffset2;
@@ -304,14 +299,13 @@ class InformativeDataApplier {
304299 }
305300
306301 void _applyToConstructors (
307- List <ConstructorElement > elementList,
302+ List <ConstructorElementImpl > elementList,
308303 List <_InfoConstructorDeclaration > infoList,
309304 ) {
310- forCorrespondingPairs < ConstructorElement , _InfoConstructorDeclaration > (
305+ forCorrespondingPairs (
311306 elementList,
312307 infoList,
313308 (element, info) {
314- element as ConstructorElementImpl ;
315309 element.setCodeRange (info.codeOffset, info.codeLength);
316310 element.typeNameOffset = info.typeNameOffset;
317311 element.periodOffset = info.periodOffset;
@@ -345,10 +339,9 @@ class InformativeDataApplier {
345339 }
346340
347341 void _applyToEnumDeclaration (
348- EnumElement element,
342+ EnumElementImpl element,
349343 _InfoClassDeclaration info,
350344 ) {
351- element as EnumElementImpl ;
352345 element.setCodeRange (info.codeOffset, info.codeLength);
353346 element.nameOffset = info.nameOffset;
354347 element.nameOffset2 = info.nameOffset2;
@@ -383,22 +376,20 @@ class InformativeDataApplier {
383376 List <LibraryExportElementImpl > exports,
384377 _InfoUnit info,
385378 ) {
386- forCorrespondingPairs < LibraryExportElement , _InfoExport > (
379+ forCorrespondingPairs (
387380 exports,
388381 info.exports,
389382 (element, info) {
390- element as LibraryExportElementImpl ;
391383 element.nameOffset = info.nameOffset;
392384 _applyToCombinators (element.combinators, info.combinators);
393385 },
394386 );
395387 }
396388
397389 void _applyToExtensionDeclaration (
398- ExtensionElement element,
390+ ExtensionElementImpl element,
399391 _InfoClassDeclaration info,
400392 ) {
401- element as ExtensionElementImpl ;
402393 element.setCodeRange (info.codeOffset, info.codeLength);
403394 element.nameOffset = info.nameOffset;
404395 element.nameOffset2 = info.nameOffset2;
@@ -428,10 +419,9 @@ class InformativeDataApplier {
428419 }
429420
430421 void _applyToExtensionTypeDeclaration (
431- ExtensionTypeElement element,
422+ ExtensionTypeElementImpl element,
432423 _InfoExtensionTypeDeclaration info,
433424 ) {
434- element as ExtensionTypeElementImpl ;
435425 element.setCodeRange (info.codeOffset, info.codeLength);
436426 element.nameOffset = info.nameOffset;
437427 element.nameOffset2 = info.nameOffset2;
@@ -476,7 +466,7 @@ class InformativeDataApplier {
476466 primaryConstructor.nameOffset2 = infoRep.constructorNameOffset2;
477467
478468 var primaryConstructorParameter =
479- primaryConstructor.parameters_unresolved.first as ParameterElementImpl ;
469+ primaryConstructor.parameters_unresolved.first;
480470 primaryConstructorParameter.nameOffset = infoRep.fieldNameOffset;
481471 primaryConstructorParameter.nameOffset2 = infoRep.fieldNameOffset2;
482472 primaryConstructorParameter.setCodeRange (
@@ -510,14 +500,13 @@ class InformativeDataApplier {
510500 }
511501
512502 void _applyToFields (
513- List <FieldElement > elementList,
503+ List <FieldElementImpl > elementList,
514504 List <_InfoFieldDeclaration > infoList,
515505 ) {
516- forCorrespondingPairs < FieldElement , _InfoFieldDeclaration > (
506+ forCorrespondingPairs (
517507 elementList.notSynthetic,
518508 infoList,
519509 (element, info) {
520- element as FieldElementImpl ;
521510 element.setCodeRange (info.codeOffset, info.codeLength);
522511 element.nameOffset = info.nameOffset;
523512 element.nameOffset2 = info.nameOffset2;
@@ -542,14 +531,13 @@ class InformativeDataApplier {
542531 }
543532
544533 void _applyToFormalParameters (
545- List <ParameterElement > parameters,
534+ List <ParameterElementImpl > parameters,
546535 List <_InfoFormalParameter > infoList,
547536 ) {
548- forCorrespondingPairs < ParameterElement , _InfoFormalParameter > (
537+ forCorrespondingPairs (
549538 parameters,
550539 infoList,
551540 (element, info) {
552- element as ParameterElementImpl ;
553541 element.setCodeRange (info.codeOffset, info.codeLength);
554542 element.nameOffset = info.nameOffset;
555543 element.nameOffset2 = info.nameOffset2;
@@ -560,10 +548,9 @@ class InformativeDataApplier {
560548 }
561549
562550 void _applyToFunctionDeclaration (
563- FunctionElement element,
551+ TopLevelFunctionFragmentImpl element,
564552 _InfoFunctionDeclaration info,
565553 ) {
566- element as TopLevelFunctionFragmentImpl ;
567554 element.setCodeRange (info.codeOffset, info.codeLength);
568555 element.nameOffset = info.nameOffset;
569556 element.nameOffset2 = info.nameOffset2;
@@ -595,10 +582,9 @@ class InformativeDataApplier {
595582 }
596583
597584 void _applyToFunctionTypeAlias (
598- TypeAliasElement element,
585+ TypeAliasElementImpl element,
599586 _InfoFunctionTypeAlias info,
600587 ) {
601- element as TypeAliasElementImpl ;
602588 element.setCodeRange (info.codeOffset, info.codeLength);
603589 element.nameOffset = info.nameOffset;
604590 element.nameOffset2 = info.nameOffset2;
@@ -616,10 +602,9 @@ class InformativeDataApplier {
616602 }
617603
618604 void _applyToGenericTypeAlias (
619- TypeAliasElement element,
605+ TypeAliasElementImpl element,
620606 _InfoGenericTypeAlias info,
621607 ) {
622- element as TypeAliasElementImpl ;
623608 element.setCodeRange (info.codeOffset, info.codeLength);
624609 element.nameOffset = info.nameOffset;
625610 element.nameOffset2 = info.nameOffset2;
@@ -641,11 +626,10 @@ class InformativeDataApplier {
641626 List <LibraryImportElementImpl > imports,
642627 _InfoUnit info,
643628 ) {
644- forCorrespondingPairs < LibraryImportElement , _InfoImport > (
629+ forCorrespondingPairs (
645630 imports,
646631 info.imports,
647632 (element, info) {
648- element as LibraryImportElementImpl ;
649633 element.nameOffset = info.nameOffset;
650634
651635 var prefixElement = element.prefix? .element;
@@ -688,14 +672,13 @@ class InformativeDataApplier {
688672 }
689673
690674 void _applyToMethods (
691- List <MethodElement > elementList,
675+ List <MethodElementImpl > elementList,
692676 List <_InfoMethodDeclaration > infoList,
693677 ) {
694- forCorrespondingPairs < MethodElement , _InfoMethodDeclaration > (
678+ forCorrespondingPairs (
695679 elementList,
696680 infoList,
697681 (element, info) {
698- element as MethodElementImpl ;
699682 element.setCodeRange (info.codeOffset, info.codeLength);
700683 element.nameOffset = info.nameOffset;
701684 element.nameOffset2 = info.nameOffset2;
@@ -729,10 +712,9 @@ class InformativeDataApplier {
729712 }
730713
731714 void _applyToMixinDeclaration (
732- MixinElement element,
715+ MixinElementImpl element,
733716 _InfoClassDeclaration info,
734717 ) {
735- element as MixinElementImpl ;
736718 element.setCodeRange (info.codeOffset, info.codeLength);
737719 element.nameOffset = info.nameOffset;
738720 element.nameOffset2 = info.nameOffset2;
@@ -763,10 +745,9 @@ class InformativeDataApplier {
763745 }
764746
765747 void _applyToTopLevelVariable (
766- TopLevelVariableElement element,
748+ TopLevelVariableElementImpl element,
767749 _InfoTopLevelVariable info,
768750 ) {
769- element as TopLevelVariableElementImpl ;
770751 element.setCodeRange (info.codeOffset, info.codeLength);
771752 element.nameOffset = info.nameOffset;
772753 element.nameOffset2 = info.nameOffset2;
@@ -789,14 +770,13 @@ class InformativeDataApplier {
789770 }
790771
791772 void _applyToTypeParameters (
792- List <TypeParameterElement > elementList,
773+ List <TypeParameterElementImpl > elementList,
793774 List <_InfoTypeParameter > infoList,
794775 ) {
795- forCorrespondingPairs < TypeParameterElement , _InfoTypeParameter > (
776+ forCorrespondingPairs (
796777 elementList,
797778 infoList,
798779 (element, info) {
799- element as TypeParameterElementImpl ;
800780 element.setCodeRange (info.codeOffset, info.codeLength);
801781 element.nameOffset = info.nameOffset;
802782 element.nameOffset2 = info.nameOffset2;
@@ -2136,7 +2116,7 @@ class _OffsetsApplier extends _OffsetsAstVisitor {
21362116
21372117 _OffsetsApplier (this ._iterator);
21382118
2139- void applyToConstantInitializer (Element element) {
2119+ void applyToConstantInitializer (ElementImpl element) {
21402120 if (element is ConstFieldElementImpl && element.isEnumConstant) {
21412121 _applyToEnumConstantInitializer (element);
21422122 } else if (element is ConstVariableElement ) {
@@ -2150,40 +2130,40 @@ class _OffsetsApplier extends _OffsetsAstVisitor {
21502130 }
21512131 }
21522132
2153- void applyToEnumConstants (List <FieldElement > constants) {
2133+ void applyToEnumConstants (List <FieldElementImpl > constants) {
21542134 for (var constant in constants) {
21552135 applyToMetadata (constant);
21562136 }
21572137 }
21582138
2159- void applyToExports (List <LibraryExportElement > elements) {
2139+ void applyToExports (List <LibraryExportElementImpl > elements) {
21602140 for (var element in elements) {
21612141 applyToMetadata (element);
21622142 }
21632143 }
21642144
2165- void applyToFormalParameters (List <ParameterElement > formalParameters) {
2145+ void applyToFormalParameters (List <ParameterElementImpl > formalParameters) {
21662146 for (var parameter in formalParameters) {
21672147 applyToMetadata (parameter);
21682148 applyToFormalParameters (parameter.parameters);
21692149 applyToConstantInitializer (parameter);
21702150 }
21712151 }
21722152
2173- void applyToImports (List <LibraryImportElement > elements) {
2153+ void applyToImports (List <LibraryImportElementImpl > elements) {
21742154 for (var element in elements) {
21752155 applyToMetadata (element);
21762156 }
21772157 }
21782158
2179- void applyToMetadata (Element element) {
2159+ void applyToMetadata (ElementImpl element) {
21802160 for (var annotation in element.metadata) {
2181- var node = ( annotation as ElementAnnotationImpl ) .annotationAst;
2161+ var node = annotation.annotationAst;
21822162 node.accept (this );
21832163 }
21842164 }
21852165
2186- void applyToPartDirectives (List <PartElement > elements) {
2166+ void applyToPartDirectives (List <PartElementImpl > elements) {
21872167 for (var element in elements) {
21882168 applyToMetadata (element);
21892169 }
@@ -2195,7 +2175,7 @@ class _OffsetsApplier extends _OffsetsAstVisitor {
21952175 }
21962176 }
21972177
2198- void applyToTypeParameters (List <TypeParameterElement > typeParameters) {
2178+ void applyToTypeParameters (List <TypeParameterElementImpl > typeParameters) {
21992179 for (var typeParameter in typeParameters) {
22002180 applyToMetadata (typeParameter);
22012181 }
@@ -2650,7 +2630,7 @@ extension on String {
26502630 }
26512631}
26522632
2653- extension _ListOfElement <T extends Element > on List <T > {
2633+ extension _ListOfElement <T extends ElementImpl > on List <T > {
26542634 List <T > get notSynthetic {
26552635 return where ((e) => ! e.isSynthetic).toList ();
26562636 }
0 commit comments