Skip to content

Commit 47f69b1

Browse files
pqCommit Queue
authored andcommitted
[element model] migrate prefer_constructors_over_static_methods
Bug: https://github.com/dart-lang/linter/issues/5099 Change-Id: I8b165b87ac6159d3df2a7cd7f0a804b619c7eeb6 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/390022 Commit-Queue: Phil Quitslund <[email protected]> Auto-Submit: Phil Quitslund <[email protected]> Reviewed-by: Brian Wilkerson <[email protected]> Commit-Queue: Brian Wilkerson <[email protected]>
1 parent d0afa40 commit 47f69b1

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

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

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -80,10 +80,12 @@ class _Visitor extends SimpleAstVisitor<void> {
8080

8181
extension on AstNode? {
8282
InterfaceType? typeToCheckOrNull() => switch (this) {
83-
ExtensionTypeDeclaration e =>
84-
e.typeParameters == null ? e.declaredElement?.thisType : null,
85-
ClassDeclaration c =>
86-
c.typeParameters == null ? c.declaredElement?.thisType : null,
83+
ExtensionTypeDeclaration e => e.typeParameters == null
84+
? e.declaredFragment?.element.thisType
85+
: null,
86+
ClassDeclaration c => c.typeParameters == null
87+
? c.declaredFragment?.element.thisType
88+
: null,
8789
_ => null
8890
};
8991
}

0 commit comments

Comments
 (0)