mirror of
https://github.com/dart-lang/sdk
synced 2024-10-04 20:39:38 +00:00
Don't report avoid_positional_boolean_parameters
on augmentations
Fixes: https://github.com/dart-lang/linter/issues/4899 Change-Id: Iad0fe208df7e355a3ce5015f55e0f39f63caf14e Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/355262 Reviewed-by: Brian Wilkerson <brianwilkerson@google.com> Commit-Queue: Phil Quitslund <pquitslund@google.com>
This commit is contained in:
parent
3a901f50ef
commit
44a962d652
|
@ -79,6 +79,9 @@ class _Visitor extends SimpleAstVisitor<void> {
|
|||
|
||||
@override
|
||||
void visitConstructorDeclaration(ConstructorDeclaration node) {
|
||||
// Don't lint augmentations.
|
||||
if (node.isAugmentation) return;
|
||||
|
||||
var declaredElement = node.declaredElement;
|
||||
if (declaredElement != null && !declaredElement.isPrivate) {
|
||||
checkParams(node.parameters.parameters);
|
||||
|
@ -87,6 +90,9 @@ class _Visitor extends SimpleAstVisitor<void> {
|
|||
|
||||
@override
|
||||
void visitFunctionDeclaration(FunctionDeclaration node) {
|
||||
// Don't lint augmentations.
|
||||
if (node.isAugmentation) return;
|
||||
|
||||
var declaredElement = node.declaredElement;
|
||||
if (declaredElement != null && !declaredElement.isPrivate) {
|
||||
checkParams(node.functionExpression.parameters?.parameters);
|
||||
|
@ -100,6 +106,9 @@ class _Visitor extends SimpleAstVisitor<void> {
|
|||
|
||||
@override
|
||||
void visitMethodDeclaration(MethodDeclaration node) {
|
||||
// Don't lint augmentations.
|
||||
if (node.isAugmentation) return;
|
||||
|
||||
var declaredElement = node.declaredElement;
|
||||
if (declaredElement != null &&
|
||||
!node.isSetter &&
|
||||
|
|
|
@ -25,6 +25,56 @@ void f(List<bool> list) {
|
|||
''');
|
||||
}
|
||||
|
||||
test_augmentationConstructor() async {
|
||||
newFile('$testPackageLibPath/a.dart', r'''
|
||||
import augment 'test.dart';
|
||||
|
||||
class A {
|
||||
A(bool b);
|
||||
}
|
||||
''');
|
||||
|
||||
await assertNoDiagnostics(r'''
|
||||
library augment 'a.dart';
|
||||
|
||||
augment class A {
|
||||
augment A(bool b);
|
||||
}
|
||||
''');
|
||||
}
|
||||
|
||||
test_augmentationFunction() async {
|
||||
newFile('$testPackageLibPath/a.dart', r'''
|
||||
import augment 'test.dart';
|
||||
|
||||
void f(bool b) { }
|
||||
''');
|
||||
|
||||
await assertNoDiagnostics(r'''
|
||||
library augment 'a.dart';
|
||||
|
||||
augment void f(bool b) { }
|
||||
''');
|
||||
}
|
||||
|
||||
test_augmentationMethod() async {
|
||||
newFile('$testPackageLibPath/a.dart', r'''
|
||||
import augment 'test.dart';
|
||||
|
||||
class A {
|
||||
void f(bool b) { }
|
||||
}
|
||||
''');
|
||||
|
||||
await assertNoDiagnostics(r'''
|
||||
library augment 'a.dart';
|
||||
|
||||
augment class A {
|
||||
augment void f(bool b) { }
|
||||
}
|
||||
''');
|
||||
}
|
||||
|
||||
test_constructor_fieldFormalParameter_named() async {
|
||||
await assertNoDiagnostics(r'''
|
||||
class C {
|
||||
|
@ -34,7 +84,7 @@ class C {
|
|||
''');
|
||||
}
|
||||
|
||||
test_constructor_fieldFormalParameter_postional() async {
|
||||
test_constructor_fieldFormalParameter_positional() async {
|
||||
await assertDiagnostics(r'''
|
||||
class C {
|
||||
bool p;
|
||||
|
|
Loading…
Reference in a new issue