Skip to content

Commit 5c2b012

Browse files
committed
Add AnonymousMethodNode::getDeclarationSection method
1 parent 88eb3db commit 5c2b012

File tree

3 files changed

+13
-0
lines changed

3 files changed

+13
-0
lines changed

CHANGELOG.md

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

1010
### Added
1111

12+
- **API:** `AnonymousMethodNode::getDeclarationSection` method.
1213
- **API:** `AnonymousMethodNode::getStatementBlock` method.
1314
- **API:** `AnonymousMethodNode::isEmpty` method.
1415

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

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,12 @@
2525
import java.util.Set;
2626
import java.util.stream.Collectors;
2727
import javax.annotation.Nonnull;
28+
import javax.annotation.Nullable;
2829
import org.antlr.runtime.Token;
2930
import org.sonar.plugins.communitydelphi.api.ast.AnonymousMethodHeadingNode;
3031
import org.sonar.plugins.communitydelphi.api.ast.AnonymousMethodNode;
3132
import org.sonar.plugins.communitydelphi.api.ast.CompoundStatementNode;
33+
import org.sonar.plugins.communitydelphi.api.ast.LocalDeclarationSectionNode;
3234
import org.sonar.plugins.communitydelphi.api.ast.RoutineParametersNode;
3335
import org.sonar.plugins.communitydelphi.api.ast.RoutineReturnTypeNode;
3436
import org.sonar.plugins.communitydelphi.api.symbol.declaration.RoutineDirective;
@@ -99,6 +101,12 @@ public boolean isProcedure() {
99101
return getRoutineKind() == RoutineKind.PROCEDURE;
100102
}
101103

104+
@Override
105+
@Nullable
106+
public LocalDeclarationSectionNode getDeclarationSection() {
107+
return getFirstChildOfType(LocalDeclarationSectionNode.class);
108+
}
109+
102110
@Override
103111
public CompoundStatementNode getStatementBlock() {
104112
return getFirstChildOfType(CompoundStatementNode.class);

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
package org.sonar.plugins.communitydelphi.api.ast;
2020

2121
import java.util.Set;
22+
import javax.annotation.Nullable;
2223
import org.sonar.plugins.communitydelphi.api.symbol.declaration.RoutineDirective;
2324
import org.sonar.plugins.communitydelphi.api.symbol.declaration.RoutineKind;
2425
import org.sonar.plugins.communitydelphi.api.type.Type;
@@ -42,6 +43,9 @@ public interface AnonymousMethodNode extends ExpressionNode {
4243

4344
boolean isProcedure();
4445

46+
@Nullable
47+
LocalDeclarationSectionNode getDeclarationSection();
48+
4549
CompoundStatementNode getStatementBlock();
4650

4751
boolean isEmpty();

0 commit comments

Comments
 (0)