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

Commit 4f1d7df

Browse files
authored
+ analyzer 5.11.1 (#4314)
* + analyzer 5.11.1 * Failing test fix * + new warning
1 parent 4cec16a commit 4f1d7df

14 files changed

+33
-33
lines changed

lib/src/rules/avoid_double_and_int_checks.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,8 @@ class _Visitor extends SimpleAstVisitor<void> {
7575
void visitIfStatement(IfStatement node) {
7676
var elseStatement = node.elseStatement;
7777
if (elseStatement is IfStatement) {
78-
var ifCondition = node.condition;
79-
var elseCondition = elseStatement.condition;
78+
var ifCondition = node.expression;
79+
var elseCondition = elseStatement.expression;
8080
if (ifCondition is IsExpression && elseCondition is IsExpression) {
8181
var typeProvider = context.typeProvider;
8282
var ifExpression = ifCondition.expression;

lib/src/rules/avoid_print.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ class _Visitor extends SimpleAstVisitor {
9999
while (node != null) {
100100
var parent = node.parent;
101101
if (parent is IfStatement && node == parent.thenStatement) {
102-
var condition = parent.condition;
102+
var condition = parent.expression;
103103
if (condition is SimpleIdentifier &&
104104
isKDebugMode(condition.staticElement)) {
105105
return true;

lib/src/rules/literal_only_boolean_expressions.dart

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

161161
@override
162162
void visitIfStatement(IfStatement node) {
163-
if (_onlyLiterals(node.condition)) {
163+
if (_onlyLiterals(node.expression)) {
164164
rule.reportLint(node);
165165
}
166166
}

lib/src/rules/prefer_conditional_assignment.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ class _Visitor extends SimpleAstVisitor<void> {
9999
if (node.elseStatement != null) {
100100
return;
101101
}
102-
var expressionInCondition = _getExpressionCondition(node.condition);
102+
var expressionInCondition = _getExpressionCondition(node.expression);
103103
if (expressionInCondition != null &&
104104
_checkStatement(node.thenStatement, expressionInCondition)) {
105105
rule.reportLint(node);

lib/src/rules/prefer_null_aware_method_calls.dart

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

7070
@override
7171
void visitIfStatement(IfStatement node) {
72-
var condition = node.condition;
72+
var condition = node.expression;
7373
if (condition is BinaryExpression &&
7474
condition.operator.type == TokenType.BANG_EQ &&
7575
condition.rightOperand is NullLiteral &&

lib/src/rules/unnecessary_parenthesis.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -133,8 +133,8 @@ class _Visitor extends SimpleAstVisitor<void> {
133133
if (parent is ParenthesizedExpression ||
134134
parent is InterpolationExpression ||
135135
(parent is ArgumentList && parent.arguments.length == 1) ||
136-
(parent is IfStatement && node == parent.condition) ||
137-
(parent is IfElement && node == parent.condition) ||
136+
(parent is IfStatement && node == parent.expression) ||
137+
(parent is IfElement && node == parent.expression) ||
138138
(parent is WhileStatement && node == parent.condition) ||
139139
(parent is DoStatement && node == parent.condition) ||
140140
(parent is SwitchStatement && node == parent.expression) ||

lib/src/rules/use_build_context_synchronously.dart

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ class _Visitor extends SimpleAstVisitor {
183183
}
184184
} else if (parent is IfStatement) {
185185
// Only check the actual statement(s), not the IF condition
186-
if (child is Statement && parent.condition.hasAwait) {
186+
if (child is Statement && parent.expression.hasAwait) {
187187
rule.reportLint(node);
188188
}
189189

@@ -203,7 +203,7 @@ class _Visitor extends SimpleAstVisitor {
203203
// their own mounted checks. The cost of this generality is the possibility
204204
// of false negatives.
205205
if (statement is IfStatement) {
206-
var condition = statement.condition;
206+
var condition = statement.expression;
207207

208208
Expression check;
209209
if (condition is PrefixExpression) {
@@ -328,7 +328,7 @@ extension on Statement {
328328
bool get isAsync {
329329
var self = this;
330330
if (self is IfStatement) {
331-
if (self.condition.hasAwait) return true;
331+
if (self.expression.hasAwait) return true;
332332
if (self.thenStatement.terminatesControl) {
333333
var elseStatement = self.elseStatement;
334334
if (elseStatement == null || elseStatement.terminatesControl) {

lib/src/util/condition_scope_visitor.dart

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,7 @@ abstract class ConditionScopeVisitor extends RecursiveAstVisitor {
215215

216216
@override
217217
void visitIfStatement(IfStatement node) {
218-
var elseScope = _visitElseStatement(node.elseStatement, node.condition);
218+
var elseScope = _visitElseStatement(node.elseStatement, node.expression);
219219
_visitIfStatement(node);
220220
if (elseScope != null) {
221221
_propagateUndefinedExpressions(elseScope);
@@ -229,10 +229,10 @@ abstract class ConditionScopeVisitor extends RecursiveAstVisitor {
229229
return;
230230
}
231231
if (addFalseCondition) {
232-
_addFalseCondition(node.condition);
232+
_addFalseCondition(node.expression);
233233
}
234234
if (addTrueCondition) {
235-
_addTrueCondition(node.condition);
235+
_addTrueCondition(node.expression);
236236
}
237237
}
238238

@@ -391,9 +391,9 @@ abstract class ConditionScopeVisitor extends RecursiveAstVisitor {
391391

392392
void _visitIfStatement(IfStatement node) {
393393
_addScope();
394-
node.condition.accept(this);
395-
visitCondition(node.condition);
396-
_addTrueCondition(node.condition);
394+
node.expression.accept(this);
395+
visitCondition(node.expression);
396+
_addTrueCondition(node.expression);
397397
node.thenStatement.accept(this);
398398
_propagateUndefinedExpressions(_removeLastScope());
399399
}

pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ environment:
1212
sdk: ^3.0.0-0
1313

1414
dependencies:
15-
analyzer: ^5.10.0
15+
analyzer: ^5.11.1
1616
args: ^2.1.0
1717
collection: ^1.15.0
1818
http: ^0.13.0

test/rules/implicit_reopen_test.dart

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -261,9 +261,6 @@ base class D = C with M;
261261
]);
262262
}
263263

264-
@FailingTest(
265-
issue: 'https://github.com/dart-lang/sdk/issues/51891',
266-
reason: 'class type aliases cannot be annotated')
267264
test_classTypeAlias_classBase_classFinal_reopened() async {
268265
await assertNoDiagnostics(r'''
269266
import 'package:meta/meta.dart';

0 commit comments

Comments
 (0)