@@ -84,7 +84,6 @@ import 'package:analyzer/src/generated/utilities_dart.dart';
8484import 'package:analyzer/src/generated/variable_type_provider.dart' ;
8585import 'package:analyzer/src/task/inference_error.dart' ;
8686import 'package:analyzer/src/util/ast_data_extractor.dart' ;
87- import 'package:analyzer/src/utilities/extensions/object.dart' ;
8887
8988typedef SharedMatchContext = shared.MatchContext <AstNode , Expression ,
9089 DartPattern , DartType , PromotableElement >;
@@ -2148,7 +2147,7 @@ class ResolverVisitor extends ThrowingAstVisitor<void>
21482147 var outerAugmentation = _enclosingAugmentation;
21492148 try {
21502149 _enclosingFunction = element;
2151- _enclosingAugmentation = element. ifTypeOrNull () ;
2150+ _enclosingAugmentation = element;
21522151 assert (_thisType == null );
21532152 _setupThisType ();
21542153 checkUnreachableNode (node);
@@ -2596,7 +2595,9 @@ class ResolverVisitor extends ThrowingAstVisitor<void>
25962595 try {
25972596 _enclosingFunction = element;
25982597 if (! isLocal) {
2599- _enclosingAugmentation = element.ifTypeOrNull ();
2598+ if (element case AugmentableElement enclosingAugmentation) {
2599+ _enclosingAugmentation = enclosingAugmentation;
2600+ }
26002601 }
26012602 checkUnreachableNode (node);
26022603 node.documentationComment? .accept (this );
@@ -2938,7 +2939,9 @@ class ResolverVisitor extends ThrowingAstVisitor<void>
29382939 var outerAugmentation = _enclosingAugmentation;
29392940 try {
29402941 _enclosingFunction = element;
2941- _enclosingAugmentation = element.ifTypeOrNull ();
2942+ if (element case AugmentableElement enclosingAugmentation) {
2943+ _enclosingAugmentation = enclosingAugmentation;
2944+ }
29422945 assert (_thisType == null );
29432946 _setupThisType ();
29442947 checkUnreachableNode (node);
@@ -3565,7 +3568,9 @@ class ResolverVisitor extends ThrowingAstVisitor<void>
35653568
35663569 var outerAugmentation = _enclosingAugmentation;
35673570 try {
3568- _enclosingAugmentation = element.ifTypeOrNull ();
3571+ if (element case AugmentableElement enclosingAugmentation) {
3572+ _enclosingAugmentation = enclosingAugmentation;
3573+ }
35693574 libraryResolutionContext._variableNodes[element] = node;
35703575 _variableDeclarationResolver.resolve (node);
35713576 } finally {
0 commit comments