Skip to content

Commit fea035a

Browse files
committed
Changes to fix in a9a38e7.
I don't think we have this bug with unordered() any longer, perhaps due to arbitrary call string lengths of ctor fixes.
1 parent 64ff635 commit fea035a

File tree

1 file changed

+6
-26
lines changed

1 file changed

+6
-26
lines changed

edu.cuny.hunter.streamrefactoring.core/src/edu/cuny/hunter/streamrefactoring/core/analysis/StreamStateMachine.java

Lines changed: 6 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -746,46 +746,26 @@ private void discoverPossibleSideEffects(EclipseProjectAnalysisEngine<InstanceKe
746746
continue;
747747

748748
CallStringWithReceivers callString = Util.getCallString(instance);
749-
CallSiteReference[] callSiteRefs = callString.getCallSiteRefs();
750-
assert callSiteRefs.length == 2 : "Expecting call sites two-deep.";
749+
assert callString.getMethods().length >= 1 : "Expecting call sites at least one-deep.";
751750

752-
// get the target of the caller.
753-
MethodReference callerDeclaredTarget = callSiteRefs[1].getDeclaredTarget();
754-
755-
// get it's IR.
756-
IMethod callerTargetMethod = engine.getClassHierarchy().resolveMethod(callerDeclaredTarget);
757-
boolean fallback = false;
758-
759-
if (callerTargetMethod == null) {
760-
LOGGER.warning("Cannot resolve caller declared target method: " + callerDeclaredTarget);
761-
762-
// fall back.
763-
callerTargetMethod = callString.getMethods()[1];
764-
LOGGER.warning("Falling back to method: " + callerTargetMethod);
765-
fallback = true;
766-
}
767-
768-
IR ir = engine.getCache().getIR(callerTargetMethod);
751+
IR ir = engine.getCache().getIR(callString.getMethods()[0]);
769752

770753
if (ir == null) {
771-
LOGGER.warning("Can't find IR for target: " + callerTargetMethod);
754+
LOGGER.warning("Can't find IR for target: " + callString.getMethods()[0]);
772755
continue; // next instance.
773756
}
774757

775758
// get calls to the caller target.
776-
// if we are falling back, use index 1, otherwise stick with index
777-
// 0.
778-
int callSiteRefsInx = fallback ? 1 : 0;
779-
SSAAbstractInvokeInstruction[] calls = ir.getCalls(callSiteRefs[callSiteRefsInx]);
759+
SSAAbstractInvokeInstruction[] calls = ir.getCalls(callString.getCallSiteRefs()[0]);
780760
assert calls.length == 1 : "Are we only expecting one call here?";
781761

782762
// I guess we're only interested in ones with a single behavioral
783763
// parameter (the first parameter is implicit).
784764
if (calls[0].getNumberOfUses() == 2) {
785765
// get the use of the first parameter.
786766
int use = calls[0].getUse(1);
787-
this.discoverLambdaSideEffects(engine, mod, Collections.singleton(instance), callerDeclaredTarget, ir,
788-
use);
767+
this.discoverLambdaSideEffects(engine, mod, Collections.singleton(instance),
768+
callString.getMethods()[0].getReference(), ir, use);
789769
}
790770
}
791771
}

0 commit comments

Comments
 (0)