@@ -944,6 +944,7 @@ class ErrorVerifier extends RecursiveAstVisitor<void>
944944
945945 @override
946946 void visitFunctionDeclaration (covariant FunctionDeclarationImpl node) {
947+ var fragment = node.declaredFragment! ;
947948 var element = node.declaredElement! ;
948949 if (element.enclosingElement3 is ! CompilationUnitElement ) {
949950 _hiddenElements! .declare (element);
@@ -961,17 +962,16 @@ class ErrorVerifier extends RecursiveAstVisitor<void>
961962 }
962963 _checkForTypeAnnotationDeferredClass (returnType);
963964 _returnTypeVerifier.verifyReturnType (returnType);
964- _checkForMainFunction1 (node.name, node.declaredElement ! );
965+ _checkForMainFunction1 (node.name, element );
965966 _checkForMainFunction2 (node);
966967 _checkAugmentations (
967968 augmentKeyword: node.augmentKeyword,
968969 element: element,
969970 );
970971 super .visitFunctionDeclaration (node);
971972 },
972- // TODO(pq): store fragment above.
973- isAsynchronous: node.declaredFragment! .isAsynchronous,
974- isGenerator: node.declaredFragment! .isGenerator,
973+ isAsynchronous: fragment.isAsynchronous,
974+ isGenerator: fragment.isGenerator,
975975 );
976976 }
977977
@@ -1067,14 +1067,14 @@ class ErrorVerifier extends RecursiveAstVisitor<void>
10671067
10681068 @override
10691069 void visitImportDirective (ImportDirective node) {
1070- var importElement = node.element ;
1070+ var importElement = node.libraryImport ;
10711071 if (node.prefix != null ) {
10721072 _checkForBuiltInIdentifierAsName (node.prefix! .token,
10731073 CompileTimeErrorCode .BUILT_IN_IDENTIFIER_AS_PREFIX_NAME );
10741074 }
10751075 if (importElement != null ) {
10761076 _checkForImportInternalLibrary (node, importElement);
1077- if (importElement.prefix is DeferredImportElementPrefix ) {
1077+ if (importElement.prefix2 ? .isDeferred ?? false ) {
10781078 _checkForDeferredImportOfExtensions (node, importElement);
10791079 }
10801080 }
@@ -1169,6 +1169,7 @@ class ErrorVerifier extends RecursiveAstVisitor<void>
11691169
11701170 @override
11711171 void visitMethodDeclaration (covariant MethodDeclarationImpl node) {
1172+ var fragment = node.declaredFragment! ;
11721173 var element = node.declaredElement! ;
11731174 _withEnclosingExecutable (
11741175 element.asElement2,
@@ -1197,9 +1198,8 @@ class ErrorVerifier extends RecursiveAstVisitor<void>
11971198 );
11981199 super .visitMethodDeclaration (node);
11991200 },
1200- // TODO(pq): store fragment above.
1201- isAsynchronous: node.declaredFragment! .isAsynchronous,
1202- isGenerator: node.declaredFragment! .isGenerator,
1201+ isAsynchronous: fragment.isAsynchronous,
1202+ isGenerator: fragment.isGenerator,
12031203 );
12041204 }
12051205
@@ -3079,9 +3079,9 @@ class ErrorVerifier extends RecursiveAstVisitor<void>
30793079 /// Report a diagnostic if there are any extensions in the imported library
30803080 /// that are not hidden.
30813081 void _checkForDeferredImportOfExtensions (
3082- ImportDirective directive, LibraryImportElement importElement) {
3083- for (var element in importElement.namespace.definedNames .values) {
3084- if (element is ExtensionElement ) {
3082+ ImportDirective directive, LibraryImport importElement) {
3083+ for (var element in importElement.namespace.definedNames2 .values) {
3084+ if (element is ExtensionElement2 ) {
30853085 errorReporter.atNode (
30863086 directive.uri,
30873087 CompileTimeErrorCode .DEFERRED_IMPORT_OF_EXTENSION ,
@@ -3830,19 +3830,19 @@ class ErrorVerifier extends RecursiveAstVisitor<void>
38303830 /// [LibraryImportElement] retrieved from the node, if the element in the node
38313831 /// was `null` , then this method is not called.
38323832 void _checkForImportInternalLibrary (
3833- ImportDirective directive, LibraryImportElement importElement) {
3833+ ImportDirective directive, LibraryImport importElement) {
38343834 if (_isInSystemLibrary || _isWasm (importElement)) {
38353835 return ;
38363836 }
38373837
3838- var importedLibrary = importElement.importedLibrary ;
3838+ var importedLibrary = importElement.importedLibrary2 ;
38393839 if (importedLibrary == null ) {
38403840 return ;
38413841 }
38423842
38433843 // should be private
38443844 var sdk = _currentLibrary.context.sourceFactory.dartSdk! ;
3845- var uri = importedLibrary.source. uri.toString ();
3845+ var uri = importedLibrary.uri.toString ();
38463846 var sdkLibrary = sdk.getSdkLibrary (uri);
38473847 if (sdkLibrary == null || ! sdkLibrary.isInternal) {
38483848 return ;
@@ -6425,8 +6425,8 @@ class ErrorVerifier extends RecursiveAstVisitor<void>
64256425 /// Return `true` if the [importElement] is the internal library `dart:_wasm`
64266426 /// and the current library is either `package:js/js.dart` or is in
64276427 /// `package:ui` .
6428- bool _isWasm (LibraryImportElement importElement) {
6429- var importedUri = importElement.importedLibrary ? .source .uri.toString ();
6428+ bool _isWasm (LibraryImport importElement) {
6429+ var importedUri = importElement.importedLibrary2 ? .uri.toString ();
64306430 if (importedUri != 'dart:_wasm' ) {
64316431 return false ;
64326432 }
@@ -6520,43 +6520,9 @@ class ErrorVerifier extends RecursiveAstVisitor<void>
65206520 }
65216521 }
65226522
6523- /// Return [FieldElement] s that are declared in the [ClassDeclaration] with
6524- /// the given [constructor] , but are not initialized.
6525- static List <FieldElement > computeNotInitializedFields (
6526- ConstructorDeclaration constructor) {
6527- Set <FieldElement > fields = < FieldElement > {};
6528- var classDeclaration = constructor.parent as ClassDeclaration ;
6529- for (ClassMember fieldDeclaration in classDeclaration.members) {
6530- if (fieldDeclaration is FieldDeclaration ) {
6531- for (VariableDeclaration field in fieldDeclaration.fields.variables) {
6532- if (field.initializer == null ) {
6533- fields.add (field.declaredElement as FieldElement );
6534- }
6535- }
6536- }
6537- }
6538-
6539- List <FormalParameter > parameters = constructor.parameters.parameters;
6540- for (FormalParameter parameter in parameters) {
6541- parameter = parameter.notDefault;
6542- if (parameter is FieldFormalParameter ) {
6543- var element = parameter.declaredElement as FieldFormalParameterElement ;
6544- fields.remove (element.field);
6545- }
6546- }
6547-
6548- for (ConstructorInitializer initializer in constructor.initializers) {
6549- if (initializer is ConstructorFieldInitializer ) {
6550- fields.remove (initializer.fieldName.staticElement);
6551- }
6552- }
6553-
6554- return fields.toList ();
6555- }
6556-
6557- /// Return [FieldElement] s that are declared in the [ClassDeclaration] with
6523+ /// Return [FieldElement2] s that are declared in the [ClassDeclaration] with
65586524 /// the given [constructor] , but are not initialized.
6559- static List <FieldElement2 > computeNotInitializedFields2 (
6525+ static List <FieldElement2 > computeNotInitializedFields (
65606526 ConstructorDeclaration constructor) {
65616527 var fields = < FieldElement2 > {};
65626528 var classDeclaration = constructor.parent as ClassDeclaration ;
0 commit comments