Skip to content

Commit 0248324

Browse files
pqCommit Queue
authored andcommitted
[cq] bump linter to 3.7 and tall-style format
Change-Id: I08e8310c6133418fd99954c306601b277a85f3c5 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/403932 Reviewed-by: Brian Wilkerson <[email protected]> Commit-Queue: Phil Quitslund <[email protected]>
1 parent 238db6e commit 0248324

File tree

523 files changed

+16394
-12902
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

523 files changed

+16394
-12902
lines changed

pkg/linter/lib/src/ast.dart

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -361,8 +361,11 @@ List<String> _collectReservedWords() {
361361
return reserved;
362362
}
363363

364-
int? _getIntValue(Expression expression, LinterContext? context,
365-
{bool negated = false}) {
364+
int? _getIntValue(
365+
Expression expression,
366+
LinterContext? context, {
367+
bool negated = false,
368+
}) {
366369
int? value;
367370
if (expression is IntegerLiteral) {
368371
value = expression.value;

pkg/linter/lib/src/extensions.dart

Lines changed: 37 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,7 @@ import 'package:analyzer/dart/element/type.dart';
1010
import 'package:analyzer/file_system/physical_file_system.dart';
1111
import 'package:analyzer/src/dart/ast/ast.dart'; // ignore: implementation_imports
1212
import 'package:analyzer/src/dart/element/type.dart' // ignore: implementation_imports
13-
show
14-
InvalidTypeImpl;
13+
show InvalidTypeImpl;
1514
import 'package:collection/collection.dart';
1615

1716
import 'analyzer.dart';
@@ -54,7 +53,7 @@ extension AstNodeExtension on AstNode {
5453
TopLevelVariableDeclaration() => self.augmentKeyword != null,
5554
VariableDeclaration(declaredFragment: var fragment?) =>
5655
fragment is PropertyInducingFragment && fragment.isAugmentation,
57-
_ => false
56+
_ => false,
5857
};
5958
}
6059

@@ -299,10 +298,11 @@ extension DartTypeExtension on DartType? {
299298
}
300299

301300
static bool _extendsClass(
302-
InterfaceType? type,
303-
Set<InterfaceElement2> seenElements,
304-
String? className,
305-
String? library) =>
301+
InterfaceType? type,
302+
Set<InterfaceElement2> seenElements,
303+
String? className,
304+
String? library,
305+
) =>
306306
type != null &&
307307
seenElements.add(type.element3) &&
308308
(type.isSameAs(className, library) ||
@@ -311,9 +311,9 @@ extension DartTypeExtension on DartType? {
311311

312312
extension ElementExtension on Element2? {
313313
Element2? get canonicalElement2 => switch (this) {
314-
PropertyAccessorElement2(:var variable3?) => variable3,
315-
_ => this,
316-
};
314+
PropertyAccessorElement2(:var variable3?) => variable3,
315+
_ => this,
316+
};
317317

318318
bool get isDartCorePrint {
319319
var self = this;
@@ -323,9 +323,9 @@ extension ElementExtension on Element2? {
323323
}
324324

325325
bool get isMacro => switch (this) {
326-
ClassElement2(:var isMacro) => isMacro,
327-
_ => false,
328-
};
326+
ClassElement2(:var isMacro) => isMacro,
327+
_ => false,
328+
};
329329
}
330330

331331
extension ExpressionExtension on Expression? {
@@ -494,9 +494,10 @@ extension InterfaceTypeExtension on InterfaceType {
494494
/// including itself.
495495
Iterable<InterfaceType> get implementedInterfaces {
496496
void searchSupertypes(
497-
InterfaceType? type,
498-
Set<InterfaceElement2> alreadyVisited,
499-
List<InterfaceType> interfaceTypes) {
497+
InterfaceType? type,
498+
Set<InterfaceElement2> alreadyVisited,
499+
List<InterfaceType> interfaceTypes,
500+
) {
500501
if (type == null || !alreadyVisited.add(type.element3)) {
501502
return;
502503
}
@@ -516,8 +517,9 @@ extension InterfaceTypeExtension on InterfaceType {
516517
}
517518

518519
GetterElement? getGetter2(String name, {LibraryElement2? library}) =>
519-
getters.firstWhereOrNull((s) =>
520-
s.name3 == name && (library == null || (s.library2 == library)));
520+
getters.firstWhereOrNull(
521+
(s) => s.name3 == name && (library == null || (s.library2 == library)),
522+
);
521523

522524
SetterElement? getSetter2(String name) =>
523525
setters.firstWhereOrNull((s) => s.canonicalName == name);
@@ -544,24 +546,28 @@ extension MethodDeclarationExtension on MethodDeclaration {
544546

545547
if (isGetter) {
546548
// Search supertypes for a getter of the same name.
547-
return parentElement.allSupertypes
548-
.any((t) => t.lookUpGetter3(name, parentLibrary) != null);
549+
return parentElement.allSupertypes.any(
550+
(t) => t.lookUpGetter3(name, parentLibrary) != null,
551+
);
549552
} else if (isSetter) {
550553
// Search supertypes for a setter of the same name.
551-
return parentElement.allSupertypes
552-
.any((t) => t.lookUpSetter3(name, parentLibrary) != null);
554+
return parentElement.allSupertypes.any(
555+
(t) => t.lookUpSetter3(name, parentLibrary) != null,
556+
);
553557
} else {
554558
// Search supertypes for a method of the same name.
555-
return parentElement.allSupertypes
556-
.any((t) => t.lookUpMethod3(name, parentLibrary) != null);
559+
return parentElement.allSupertypes.any(
560+
(t) => t.lookUpMethod3(name, parentLibrary) != null,
561+
);
557562
}
558563
}
559564

560565
bool hasInheritedMethod(InheritanceManager3 inheritanceManager) =>
561566
lookUpInheritedMethod(inheritanceManager) != null;
562567

563568
MethodElement2? lookUpInheritedMethod(
564-
InheritanceManager3 inheritanceManager) {
569+
InheritanceManager3 inheritanceManager,
570+
) {
565571
var declaredElement = declaredFragment?.element;
566572
if (declaredElement != null) {
567573
var parent = declaredElement.enclosingElement2;
@@ -605,10 +611,10 @@ extension TokenExtension on Token? {
605611

606612
extension TokenTypeExtension on TokenType {
607613
TokenType get inverted => switch (this) {
608-
TokenType.LT_EQ => TokenType.GT_EQ,
609-
TokenType.LT => TokenType.GT,
610-
TokenType.GT => TokenType.LT,
611-
TokenType.GT_EQ => TokenType.LT_EQ,
612-
_ => this
613-
};
614+
TokenType.LT_EQ => TokenType.GT_EQ,
615+
TokenType.LT => TokenType.GT,
616+
TokenType.GT => TokenType.LT,
617+
TokenType.GT_EQ => TokenType.LT_EQ,
618+
_ => this,
619+
};
614620
}

0 commit comments

Comments
 (0)