Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Added

- **API:** `AnonymousMethodNode::getDeclarationSection` method.
- **API:** `AnonymousMethodNode::getStatementBlock` method.
- **API:** `AnonymousMethodNode::isEmpty` method.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,12 @@
import java.util.Set;
import java.util.stream.Collectors;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import org.antlr.runtime.Token;
import org.sonar.plugins.communitydelphi.api.ast.AnonymousMethodHeadingNode;
import org.sonar.plugins.communitydelphi.api.ast.AnonymousMethodNode;
import org.sonar.plugins.communitydelphi.api.ast.CompoundStatementNode;
import org.sonar.plugins.communitydelphi.api.ast.LocalDeclarationSectionNode;
import org.sonar.plugins.communitydelphi.api.ast.RoutineParametersNode;
import org.sonar.plugins.communitydelphi.api.ast.RoutineReturnTypeNode;
import org.sonar.plugins.communitydelphi.api.symbol.declaration.RoutineDirective;
Expand Down Expand Up @@ -99,9 +101,15 @@ public boolean isProcedure() {
return getRoutineKind() == RoutineKind.PROCEDURE;
}

@Override
@Nullable
public LocalDeclarationSectionNode getDeclarationSection() {
return getFirstChildOfType(LocalDeclarationSectionNode.class);
}

@Override
public CompoundStatementNode getStatementBlock() {
return (CompoundStatementNode) getChild(1);
return getFirstChildOfType(CompoundStatementNode.class);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
package org.sonar.plugins.communitydelphi.api.ast;

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

boolean isProcedure();

@Nullable
LocalDeclarationSectionNode getDeclarationSection();

CompoundStatementNode getStatementBlock();

boolean isEmpty();
Expand Down