@@ -4070,7 +4070,7 @@ class ExpressionFunctionBodyImpl extends FunctionBodyImpl
40704070/// | [ConditionalExpression] cascadeSection*
40714071/// | [ThrowExpression]
40724072abstract class ExpressionImpl extends AstNodeImpl
4073- implements CollectionElementImpl , Expression {
4073+ implements CollectionElementImpl , Expression , IfConditionImpl {
40744074 /// The static type of this expression, or `null` if the AST structure has not
40754075 /// been resolved.
40764076 @override
@@ -6433,6 +6433,15 @@ abstract class IdentifierImpl extends CommentReferableExpressionImpl
64336433 bool get isAssignable => true ;
64346434}
64356435
6436+ /// A condition in an `if` statement or `if` element.
6437+ ///
6438+ /// ifCondition ::=
6439+ /// [Expression]
6440+ /// | [PatternVariableDeclaration]
6441+ /// | [PatternAssignment]
6442+ @experimental
6443+ abstract class IfConditionImpl extends AstNodeImpl implements IfCondition {}
6444+
64366445class IfElementImpl extends CollectionElementImpl implements IfElement {
64376446 @override
64386447 Token ifKeyword;
@@ -6441,7 +6450,7 @@ class IfElementImpl extends CollectionElementImpl implements IfElement {
64416450 Token leftParenthesis;
64426451
64436452 /// The condition used to determine which of the branches is executed next.
6444- ExpressionImpl _condition;
6453+ IfConditionImpl _condition;
64456454
64466455 @override
64476456 Token rightParenthesis;
@@ -6474,10 +6483,10 @@ class IfElementImpl extends CollectionElementImpl implements IfElement {
64746483 Token get beginToken => ifKeyword;
64756484
64766485 @override
6477- ExpressionImpl get condition => _condition;
6486+ ExpressionImpl get condition => _condition as ExpressionImpl ;
64786487
6479- set condition (Expression condition) {
6480- _condition = _becomeParentOf (condition as ExpressionImpl );
6488+ set condition (IfCondition condition) {
6489+ _condition = _becomeParentOf (condition as IfConditionImpl );
64816490 }
64826491
64836492 @override
@@ -6539,7 +6548,7 @@ class IfStatementImpl extends StatementImpl implements IfStatement {
65396548 Token leftParenthesis;
65406549
65416550 /// The condition used to determine which of the branches is executed next.
6542- ExpressionImpl _condition;
6551+ IfConditionImpl _condition;
65436552
65446553 @override
65456554 Token rightParenthesis;
@@ -6573,10 +6582,10 @@ class IfStatementImpl extends StatementImpl implements IfStatement {
65736582 Token get beginToken => ifKeyword;
65746583
65756584 @override
6576- ExpressionImpl get condition => _condition;
6585+ ExpressionImpl get condition => _condition as ExpressionImpl ;
65776586
6578- set condition (Expression condition) {
6579- _condition = _becomeParentOf (condition as ExpressionImpl );
6587+ set condition (IfCondition condition) {
6588+ _condition = _becomeParentOf (condition as IfConditionImpl );
65806589 }
65816590
65826591 @override
@@ -9454,7 +9463,8 @@ class PartOfDirectiveImpl extends DirectiveImpl implements PartOfDirective {
94549463/// When used as the condition in an `if` , the pattern is always a
94559464/// [PatternVariable] whose type is not `null` .
94569465@experimental
9457- class PatternAssignmentImpl extends AstNodeImpl implements PatternAssignment {
9466+ class PatternAssignmentImpl extends AstNodeImpl
9467+ implements IfConditionImpl , PatternAssignment {
94589468 @override
94599469 final Token equals;
94609470
@@ -9536,7 +9546,7 @@ class PatternAssignmentStatementImpl extends StatementImpl
95369546/// ( 'final' | 'var' ) [DartPattern] '=' [Expression]
95379547@experimental
95389548class PatternVariableDeclarationImpl extends AstNodeImpl
9539- implements PatternVariableDeclaration {
9549+ implements IfConditionImpl , PatternVariableDeclaration {
95409550 @override
95419551 final Token equals;
95429552
0 commit comments