Skip to content

Commit

Permalink
Hide ArrayAccessorNodeImpl::setImplicitNameOccurrence
Browse files Browse the repository at this point in the history
  • Loading branch information
Cirras committed Oct 19, 2023
1 parent e0aa45a commit d9f31dd
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -48,17 +48,16 @@ public List<ExpressionNode> getExpressions() {
return findChildrenOfType(ExpressionNode.class);
}

@Override
public void setImplicitNameOccurrence(NameOccurrence implicitNameOccurrence) {
this.implicitNameOccurrence = implicitNameOccurrence;
}

@Override
@Nullable
public NameOccurrence getImplicitNameOccurrence() {
return implicitNameOccurrence;
}

public void setImplicitNameOccurrence(NameOccurrence implicitNameOccurrence) {
this.implicitNameOccurrence = implicitNameOccurrence;
}

@Override
public String getImage() {
return "["
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import static org.sonar.plugins.communitydelphi.api.type.TypeFactory.unknownType;
import static org.sonar.plugins.communitydelphi.api.type.TypeFactory.voidType;

import au.com.integradev.delphi.antlr.ast.node.ArrayAccessorNodeImpl;
import au.com.integradev.delphi.antlr.ast.node.DelphiNodeImpl;
import au.com.integradev.delphi.antlr.ast.node.NameReferenceNodeImpl;
import au.com.integradev.delphi.symbol.NameOccurrenceImpl;
Expand Down Expand Up @@ -751,7 +752,7 @@ private boolean handleDefaultArrayProperties(ArrayAccessorNode accessor) {
if (propertyDeclaration instanceof PropertyNameDeclaration) {
NameOccurrenceImpl implicitOccurrence = new NameOccurrenceImpl(accessor);
implicitOccurrence.setNameDeclaration(propertyDeclaration);
accessor.setImplicitNameOccurrence(implicitOccurrence);
((ArrayAccessorNodeImpl) accessor).setImplicitNameOccurrence(implicitOccurrence);
((DelphiScopeImpl) propertyDeclaration.getScope()).addNameOccurrence(implicitOccurrence);
registerOccurrence(implicitOccurrence);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@

import static java.util.function.Predicate.not;

import au.com.integradev.delphi.antlr.ast.node.ArrayAccessorNodeImpl;
import au.com.integradev.delphi.antlr.ast.node.MutableDelphiNode;
import au.com.integradev.delphi.antlr.ast.node.NameDeclarationNodeImpl;
import au.com.integradev.delphi.antlr.ast.node.NameReferenceNodeImpl;
Expand Down Expand Up @@ -176,7 +177,8 @@ public void attach(NameReferenceNode node) {

@Override
public void attach(ArrayAccessorNode node) {
node.setImplicitNameOccurrence(registeredOccurrences.get(node.getTokenIndex()));
((ArrayAccessorNodeImpl) node)
.setImplicitNameOccurrence(registeredOccurrences.get(node.getTokenIndex()));
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,6 @@
public interface ArrayAccessorNode extends DelphiNode {
List<ExpressionNode> getExpressions();

void setImplicitNameOccurrence(NameOccurrence implicitNameOccurrence);

@Nullable
NameOccurrence getImplicitNameOccurrence();
}

0 comments on commit d9f31dd

Please sign in to comment.