Skip to content

Commit

Permalink
fix(pattern): ForEachNode#replaceNode (#2266)
Browse files Browse the repository at this point in the history
* fix(pattern): ForEachNode#replaceNode

* comment added

* fix check style
  • Loading branch information
pvojtechovsky authored and surli committed Aug 1, 2018
1 parent 28024c6 commit 59ea00e
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/main/java/spoon/pattern/internal/node/ForEachNode.java
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,13 @@ public ForEachNode() {
@Override
public boolean replaceNode(RootNode oldNode, RootNode newNode) {
if (iterableParameter == oldNode) {
//before defined iterable parameter has to be replaced by another iterable parameter
//May be it makes no sense, because
//1) the iterable parameter has to be defined first
//2) then ForEachNode can be created for that
//3) then this method might be called to replace iterable parameter again
//... but does that use case makes sense? Probably not.
iterableParameter = (PrimitiveMatcher) newNode;
return true;
}
if (iterableParameter.replaceNode(oldNode, newNode)) {
Expand Down

0 comments on commit 59ea00e

Please sign in to comment.