Issue #418 and/or detection fix

This commit is contained in:
Jindra Petřík
2015-10-22 09:49:11 +02:00
parent f3ae3e6830
commit 09ae6c62a0
7 changed files with 31 additions and 2 deletions
@@ -2004,12 +2004,12 @@ public class Graph {
if (onTrue.size() == 2) {
GraphTargetItem rightSide = ((PushItem) onTrue.get(1)).value;
GraphTargetItem prevExpr = stack.pop();
GraphTargetItem leftSide = expr;
GraphTargetItem leftSide = expr.getNotCoercedNoDup();
if (leftSide instanceof DuplicateItem) {
isIf = false;
stack.push(new OrItem(null, prevExpr, rightSide));
} else if (leftSide.invert(null) instanceof DuplicateItem) {
} else if (leftSide.invert(null).getNotCoercedNoDup() instanceof DuplicateItem) {
isIf = false;
stack.push(new AndItem(null, prevExpr, rightSide));
} else if (prevExpr instanceof FalseItem) {
@@ -250,6 +250,10 @@ public abstract class GraphTargetItem implements Serializable, Cloneable {
return this;
}
public GraphTargetItem getNotCoercedNoDup() {
return getNotCoerced();
}
public GraphTargetItem getThroughRegister() {
return this;
}
@@ -57,6 +57,11 @@ public class DuplicateItem extends GraphTargetItem implements SimpleValue {
return value.getNotCoerced();
}
@Override
public GraphTargetItem getNotCoercedNoDup() {
return this;
}
@Override
public GraphTargetItem getThroughRegister() {
return value.getThroughRegister();
@@ -62,4 +62,9 @@ public class PushItem extends GraphTargetItem {
public GraphTargetItem getThroughRegister() {
return value.getThroughRegister();
}
@Override
public GraphTargetItem getNotCoercedNoDup() {
return value.getNotCoercedNoDup();
}
}