|
2 | 2 | // for details. All rights reserved. Use of this source code is governed by a |
3 | 3 | // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
|
5 | | -// ignore_for_file: analyzer_use_new_elements |
6 | | - |
7 | 5 | import 'package:_fe_analyzer_shared/src/types/shared_type.dart'; |
8 | 6 | import 'package:analyzer/dart/ast/token.dart'; |
9 | | -import 'package:analyzer/dart/element/element.dart'; |
10 | 7 | import 'package:analyzer/dart/element/element2.dart'; |
11 | 8 | import 'package:analyzer/dart/element/type.dart'; |
12 | 9 | import 'package:analyzer/src/dart/ast/ast.dart'; |
@@ -110,11 +107,11 @@ class ForResolver { |
110 | 107 | return DynamicTypeImpl.instance; |
111 | 108 | } |
112 | 109 |
|
113 | | - ClassElement iteratedElement = isAsync |
114 | | - ? _resolver.typeProvider.streamElement |
115 | | - : _resolver.typeProvider.iterableElement; |
| 110 | + ClassElement2 iteratedElement = isAsync |
| 111 | + ? _resolver.typeProvider.streamElement2 |
| 112 | + : _resolver.typeProvider.iterableElement2; |
116 | 113 |
|
117 | | - var iteratedType = iterableType.asInstanceOf(iteratedElement); |
| 114 | + var iteratedType = iterableType.asInstanceOf2(iteratedElement); |
118 | 115 | if (iteratedType == null) { |
119 | 116 | return InvalidTypeImpl.instance; |
120 | 117 | } |
@@ -178,7 +175,7 @@ class ForResolver { |
178 | 175 | var elementType = _computeForEachElementType(iterable, isAsync); |
179 | 176 | if (loopVariable != null && loopVariable.type == null) { |
180 | 177 | var loopVariableElement = |
181 | | - loopVariable.declaredElement as LocalVariableElementImpl; |
| 178 | + loopVariable.declaredFragment?.element as LocalVariableElementImpl2; |
182 | 179 | loopVariableElement.type = elementType; |
183 | 180 | } |
184 | 181 |
|
|
0 commit comments