Skip to content

Commit ae6b4b6

Browse files
pqCommit Queue
authored and
Commit Queue
committed
[element model] migrate tighten_type_of_initializing_formals
Bug: https://github.com/dart-lang/linter/issues/5099 Change-Id: I8e540237743629b314d1439270b9fc0a33437f48 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/386970 Commit-Queue: Phil Quitslund <[email protected]> Reviewed-by: Brian Wilkerson <[email protected]>
1 parent fdcb76d commit ae6b4b6

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

pkg/linter/lib/src/rules/tighten_type_of_initializing_formals.dart

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
import 'package:analyzer/dart/ast/ast.dart';
66
import 'package:analyzer/dart/ast/token.dart';
77
import 'package:analyzer/dart/ast/visitor.dart';
8-
import 'package:analyzer/dart/element/element.dart';
8+
import 'package:analyzer/dart/element/element2.dart';
99

1010
import '../analyzer.dart';
1111
import '../linter_lint_codes.dart';
@@ -51,7 +51,7 @@ class _Visitor extends SimpleAstVisitor<void> {
5151
var staticType = leftOperand.staticType;
5252
if (staticType != null &&
5353
context.typeSystem.isNullable(staticType)) {
54-
_check(leftOperand.staticElement, node);
54+
_check(leftOperand.element, node);
5555
}
5656
}
5757
} else if (condition.leftOperand is NullLiteral) {
@@ -60,19 +60,19 @@ class _Visitor extends SimpleAstVisitor<void> {
6060
var staticType = rightOperand.staticType;
6161
if (staticType != null &&
6262
context.typeSystem.isNullable(staticType)) {
63-
_check(rightOperand.staticElement, node);
63+
_check(rightOperand.element, node);
6464
}
6565
}
6666
}
6767
}
6868
}
6969
}
7070

71-
void _check(Element? element, ConstructorDeclaration node) {
72-
if (element is FieldFormalParameterElement ||
73-
element is SuperFormalParameterElement) {
71+
void _check(Element2? element, ConstructorDeclaration node) {
72+
if (element is FieldFormalParameterElement2 ||
73+
element is SuperFormalParameterElement2) {
7474
rule.reportLint(node.parameters.parameters
75-
.firstWhere((p) => p.declaredElement == element));
75+
.firstWhere((p) => p.declaredFragment?.element == element));
7676
}
7777
}
7878
}

0 commit comments

Comments
 (0)