Skip to content

Commit 0529eb9

Browse files
committed
Add CaseStatementNode::getSelectorExpression
1 parent 909039d commit 0529eb9

File tree

3 files changed

+9
-0
lines changed

3 files changed

+9
-0
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1111

1212
- **API:** `RepeatStatementNode::getGuardExpression` method.
1313
- **API:** `RepeatStatementNode::getStatementList` method.
14+
- **API:** `CaseStatementNode::getSelectorExpression` method.
1415

1516
### Fixed
1617

delphi-frontend/src/main/java/au/com/integradev/delphi/antlr/ast/node/CaseStatementNodeImpl.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,18 @@
2525
import org.sonar.plugins.communitydelphi.api.ast.CaseItemStatementNode;
2626
import org.sonar.plugins.communitydelphi.api.ast.CaseStatementNode;
2727
import org.sonar.plugins.communitydelphi.api.ast.ElseBlockNode;
28+
import org.sonar.plugins.communitydelphi.api.ast.ExpressionNode;
2829

2930
public final class CaseStatementNodeImpl extends DelphiNodeImpl implements CaseStatementNode {
3031
public CaseStatementNodeImpl(Token token) {
3132
super(token);
3233
}
3334

35+
@Override
36+
public ExpressionNode getSelectorExpression() {
37+
return getFirstChildOfType(ExpressionNode.class);
38+
}
39+
3440
@Override
3541
public List<CaseItemStatementNode> getCaseItems() {
3642
return findChildrenOfType(CaseItemStatementNode.class);

delphi-frontend/src/main/java/org/sonar/plugins/communitydelphi/api/ast/CaseStatementNode.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@
2222
import javax.annotation.Nullable;
2323

2424
public interface CaseStatementNode extends StatementNode {
25+
ExpressionNode getSelectorExpression();
26+
2527
List<CaseItemStatementNode> getCaseItems();
2628

2729
@Nullable

0 commit comments

Comments
 (0)