Skip to content

Commit 66f0fc6

Browse files
pqCommit Queue
authored andcommitted
[element model] cleanup migrated utilities
Change-Id: I560fe2550189801a833359fbe9e06219f40a3cc3 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/390662 Auto-Submit: Phil Quitslund <[email protected]> Reviewed-by: Brian Wilkerson <[email protected]> Commit-Queue: Brian Wilkerson <[email protected]>
1 parent c92712d commit 66f0fc6

File tree

3 files changed

+6
-21
lines changed

3 files changed

+6
-21
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ class _Visitor extends SimpleAstVisitor<void> {
5050
var parent = node.parent;
5151
if (parent is IfStatement && node == parent.thenStatement) {
5252
var condition = parent.expression;
53-
if (condition is SimpleIdentifier && isKDebugMode2(condition.element)) {
53+
if (condition is SimpleIdentifier && isKDebugMode(condition.element)) {
5454
return true;
5555
}
5656
} else if (parent is FunctionBody) {

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ class _Visitor extends SimpleAstVisitor<void> {
4141

4242
var parent = node.parent;
4343
if (parent is! ClassDeclaration ||
44-
!isStatefulWidget2(parent.declaredFragment?.element)) {
44+
!isStatefulWidget(parent.declaredFragment?.element)) {
4545
return;
4646
}
4747
var body = node.body;

pkg/linter/lib/src/util/flutter_utils.dart

Lines changed: 4 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -36,18 +36,13 @@ bool isExactWidgetTypeContainer(DartType? type) =>
3636
bool isExactWidgetTypeSizedBox(DartType? type) =>
3737
_flutter.isExactWidgetTypeSizedBox(type);
3838

39-
bool isKDebugMode(Element? element) => _flutter.isKDebugMode(element);
40-
41-
bool isKDebugMode2(Element2? element) => _flutter.isKDebugMode2(element);
39+
bool isKDebugMode(Element2? element) => _flutter.isKDebugMode(element);
4240

4341
bool isState(InterfaceElement element) => _flutter.isState(element);
4442

45-
bool isStatefulWidget(ClassElement? element) =>
43+
bool isStatefulWidget(ClassElement2? element) =>
4644
element != null && _flutter.isStatefulWidget(element);
4745

48-
bool isStatefulWidget2(ClassElement2? element) =>
49-
element != null && _flutter.isStatefulWidget2(element);
50-
5146
bool isWidgetProperty(DartType? type) {
5247
if (isWidgetType(type)) {
5348
return true;
@@ -133,12 +128,7 @@ class _Flutter {
133128
type is InterfaceType &&
134129
isExactly(type.element, _nameSizedBox, _uriBasic);
135130

136-
bool isKDebugMode(Element? element) =>
137-
element != null &&
138-
element.name == 'kDebugMode' &&
139-
element.source?.uri == _uriFoundation;
140-
141-
bool isKDebugMode2(Element2? element) =>
131+
bool isKDebugMode(Element2? element) =>
142132
element != null &&
143133
element.name == 'kDebugMode' &&
144134
element.library2.uri == _uriFoundation;
@@ -148,12 +138,7 @@ class _Flutter {
148138
element.allSupertypes
149139
.any((type) => isExactly(type.element, _nameState, _uriFramework));
150140

151-
bool isStatefulWidget(ClassElement element) =>
152-
isExactly(element, _nameStatefulWidget, _uriFramework) ||
153-
element.allSupertypes.any((type) =>
154-
isExactly(type.element, _nameStatefulWidget, _uriFramework));
155-
156-
bool isStatefulWidget2(ClassElement2 element) =>
141+
bool isStatefulWidget(ClassElement2 element) =>
157142
isExactly2(element, _nameStatefulWidget, _uriFramework) ||
158143
element.allSupertypes.any((type) =>
159144
isExactly(type.element, _nameStatefulWidget, _uriFramework));

0 commit comments

Comments
 (0)