Skip to content

Commit a6668da

Browse files
scheglovCommit Queue
authored andcommitted
Elements. Migrate TypeAliasSelfReferenceFinder.
Change-Id: I6c9048b02d01144a44404cb836b2c545b9a79adf Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/406223 Reviewed-by: Phil Quitslund <[email protected]> Commit-Queue: Konstantin Shcheglov <[email protected]>
1 parent 3392647 commit a6668da

File tree

1 file changed

+7
-9
lines changed

1 file changed

+7
-9
lines changed

pkg/analyzer/lib/src/summary2/type_alias.dart

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
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-
75
import 'package:analyzer/src/dart/ast/ast.dart';
86
import 'package:analyzer/src/dart/ast/extensions.dart';
97
import 'package:analyzer/src/dart/element/element.dart';
@@ -18,13 +16,13 @@ class TypeAliasSelfReferenceFinder {
1816
if (node is FunctionTypeAliasImpl) {
1917
var finder = _Finder(linker, node);
2018
finder.functionTypeAlias(node);
21-
var element = node.declaredElement as TypeAliasElementImpl;
22-
element.hasSelfReference = finder.hasSelfReference;
19+
var fragment = node.declaredFragment as TypeAliasElementImpl;
20+
fragment.hasSelfReference = finder.hasSelfReference;
2321
} else if (node is GenericTypeAliasImpl) {
2422
var finder = _Finder(linker, node);
2523
finder.genericTypeAlias(node);
26-
var element = node.declaredElement as TypeAliasElementImpl;
27-
element.hasSelfReference = finder.hasSelfReference;
24+
var fragment = node.declaredFragment as TypeAliasElementImpl;
25+
fragment.hasSelfReference = finder.hasSelfReference;
2826
}
2927
}
3028
}
@@ -89,12 +87,12 @@ class _Finder {
8987
if (node == null) return;
9088

9189
if (node is NamedType) {
92-
var element = node.element;
93-
if (element is! ElementImpl) {
90+
var element = node.element2;
91+
if (element is! ElementImpl2) {
9492
return;
9593
}
9694

97-
var typeNode = linker.getLinkingNode(element);
95+
var typeNode = linker.getLinkingNode2(element);
9896
if (typeNode != null) {
9997
if (typeNode == self) {
10098
hasSelfReference = true;

0 commit comments

Comments
 (0)