Skip to content
This repository was archived by the owner on Nov 20, 2024. It is now read-only.

Commit 7bbd899

Browse files
committed
fix post-rebase
1 parent 80865bb commit 7bbd899

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

lib/src/rules/unreachable_from_main.dart

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -119,8 +119,8 @@ class _Visitor extends SimpleAstVisitor<void> {
119119
])
120120
.whereNotNull()
121121
.map((e) => e.thisOrAncestorMatching((a) =>
122-
a.enclosingElement2 == null ||
123-
a.enclosingElement2 is CompilationUnitElement))
122+
a.enclosingElement3 == null ||
123+
a.enclosingElement3 is CompilationUnitElement))
124124
.map((e) => declarationByElement[e])
125125
.whereNotNull()
126126
.where((e) => e != declaration)
@@ -152,12 +152,12 @@ class _Visitor extends SimpleAstVisitor<void> {
152152

153153
for (var member in unusedMembers) {
154154
if (member is NamedCompilationUnitMember) {
155-
rule.reportLint(member.name);
155+
rule.reportLintForToken(member.name2);
156156
} else if (member is VariableDeclaration) {
157-
rule.reportLint(member.name);
157+
rule.reportLintForToken(member.name2);
158158
} else if (member is ExtensionDeclaration) {
159159
rule.reportLintForToken(
160-
member.name?.token ?? member.firstTokenAfterCommentAndMetadata);
160+
member.name2 ?? member.firstTokenAfterCommentAndMetadata);
161161
} else {
162162
rule.reportLintForToken(member.firstTokenAfterCommentAndMetadata);
163163
}
@@ -166,7 +166,7 @@ class _Visitor extends SimpleAstVisitor<void> {
166166

167167
bool _isEntryPoint(Declaration e) =>
168168
e is FunctionDeclaration &&
169-
(e.name.name == 'main' || e.metadata.any(_isPragmaVmEntry));
169+
(e.name2.lexeme == 'main' || e.metadata.any(_isPragmaVmEntry));
170170

171171
bool _isPragmaVmEntry(Annotation annotation) {
172172
if (!annotation.isPragma) return false;
@@ -195,6 +195,6 @@ extension on Annotation {
195195
// Dunno what this is.
196196
return false;
197197
}
198-
return type.element?.isPragma ?? false;
198+
return type is InterfaceType && type.element2.isPragma;
199199
}
200200
}

test_data/rules/unreachable_from_main.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ main() // OK
2424
print(c2);
2525
}
2626

27-
class Comment {} // LINT
27+
class Comment {} // OK
2828

2929
const a = 1; // LINT
3030
const b = 1; // OK
@@ -91,7 +91,7 @@ void usageInTypeBound<T extends C1>() {}
9191
// Usage in Function type
9292
class C2 {}
9393

94-
void Function(C2)? usageInFunctionType() {}
94+
void Function(C2)? usageInFunctionType() => null;
9595

9696
// Usage in default value
9797
class C3 {

0 commit comments

Comments
 (0)