Skip to content

Commit 2448445

Browse files
scheglovcommit-bot@chromium.org
authored andcommitted
Make IfStatementImpl use IfMixin.
R=brianwilkerson@google.com, paulberry@google.com Change-Id: I32f967a392a96692b6633f8ee62072404cdeaa11 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/95425 Reviewed-by: Brian Wilkerson <brianwilkerson@google.com> Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
1 parent 7ba8995 commit 2448445

1 file changed

Lines changed: 14 additions & 39 deletions

File tree

pkg/analyzer/lib/src/dart/ast/ast.dart

Lines changed: 14 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -5644,6 +5644,7 @@ class IfElementImpl extends CollectionElementImpl
56445644
Iterable<SyntacticEntity> get childEntities => new ChildEntities()
56455645
..addAll(super.childEntities)
56465646
..add(_thenElement)
5647+
..add(elseKeyword)
56475648
..add(_elseElement);
56485649

56495650
@override
@@ -5694,8 +5695,7 @@ mixin IfMixin on AstNodeImpl {
56945695
..add(ifKeyword)
56955696
..add(leftParenthesis)
56965697
..add(_condition)
5697-
..add(rightParenthesis)
5698-
..add(elseKeyword);
5698+
..add(rightParenthesis);
56995699

57005700
Expression get condition => _condition;
57015701

@@ -5713,46 +5713,32 @@ mixin IfMixin on AstNodeImpl {
57135713
///
57145714
/// ifStatement ::=
57155715
/// 'if' '(' [Expression] ')' [Statement] ('else' [Statement])?
5716-
class IfStatementImpl extends StatementImpl implements IfStatement {
5717-
/// The token representing the 'if' keyword.
5718-
@override
5719-
Token ifKeyword;
5720-
5721-
/// The left parenthesis.
5722-
@override
5723-
Token leftParenthesis;
5724-
5725-
/// The condition used to determine which of the statements is executed next.
5726-
ExpressionImpl _condition;
5727-
5728-
/// The right parenthesis.
5729-
@override
5730-
Token rightParenthesis;
5731-
5716+
class IfStatementImpl extends StatementImpl
5717+
with IfMixin
5718+
implements IfStatement {
57325719
/// The statement that is executed if the condition evaluates to `true`.
57335720
StatementImpl _thenStatement;
57345721

5735-
/// The token representing the 'else' keyword, or `null` if there is no else
5736-
/// statement.
5737-
@override
5738-
Token elseKeyword;
5739-
57405722
/// The statement that is executed if the condition evaluates to `false`, or
57415723
/// `null` if there is no else statement.
57425724
StatementImpl _elseStatement;
57435725

57445726
/// Initialize a newly created if statement. The [elseKeyword] and
57455727
/// [elseStatement] can be `null` if there is no else clause.
57465728
IfStatementImpl(
5747-
this.ifKeyword,
5748-
this.leftParenthesis,
5729+
Token ifKeyword,
5730+
Token leftParenthesis,
57495731
ExpressionImpl condition,
5750-
this.rightParenthesis,
5732+
Token rightParenthesis,
57515733
StatementImpl thenStatement,
5752-
this.elseKeyword,
5734+
Token elseKeyword,
57535735
StatementImpl elseStatement) {
5736+
this.ifKeyword = ifKeyword;
5737+
this.leftParenthesis = leftParenthesis;
57545738
_condition = _becomeParentOf(condition);
5739+
this.rightParenthesis = rightParenthesis;
57555740
_thenStatement = _becomeParentOf(thenStatement);
5741+
this.elseKeyword = elseKeyword;
57565742
_elseStatement = _becomeParentOf(elseStatement);
57575743
}
57585744

@@ -5761,22 +5747,11 @@ class IfStatementImpl extends StatementImpl implements IfStatement {
57615747

57625748
@override
57635749
Iterable<SyntacticEntity> get childEntities => new ChildEntities()
5764-
..add(ifKeyword)
5765-
..add(leftParenthesis)
5766-
..add(_condition)
5767-
..add(rightParenthesis)
5750+
..addAll(super.childEntities)
57685751
..add(_thenStatement)
57695752
..add(elseKeyword)
57705753
..add(_elseStatement);
57715754

5772-
@override
5773-
Expression get condition => _condition;
5774-
5775-
@override
5776-
void set condition(Expression expression) {
5777-
_condition = _becomeParentOf(expression as ExpressionImpl);
5778-
}
5779-
57805755
@override
57815756
Statement get elseStatement => _elseStatement;
57825757

0 commit comments

Comments
 (0)