if (!unit.containsInvokeExpr()) {
continue;
}
ValueBox box = unit.getInvokeExprBox();
Value value = box.getValue();
if (value instanceof InstanceInvokeExpr) {
InstanceInvokeExpr r = (InstanceInvokeExpr) value;
if (r.getMethod().getSubSignature().equals(
PtolemyUtilities.getContainerMethod
.getSubSignature())) {
Value newFieldRef = _getContainerMethodReplacementFieldRef(
theClass, (Local) r.getBase(), body, unit,
localDefs);
box.setValue(newFieldRef);
if (_debug) {
System.out.println("replacing " + unit);
}
} else if (r.getMethod().equals(
PtolemyUtilities.toplevelMethod)) {
// Replace with reference to the toplevel
Value newFieldRef = getLocalReferenceForEntity(_model,
theClass, body.getThisLocal(), body, unit,
_options);
box.setValue(newFieldRef);
if (_debug) {
System.out.println("replacing " + unit);
}
} else if (r.getMethod().getSubSignature().equals(
PtolemyUtilities.getEntityMethod.getSubSignature())) {
Value nameValue = r.getArg(0);
if (Evaluator.isValueConstantValued(nameValue)) {
StringConstant nameConstant = (StringConstant) Evaluator
.getConstantValueOf(nameValue);
String name = nameConstant.value;
if (_debug) {
System.out.println("replacing " + unit);
}
Value newFieldRef = _getEntityMethodReplacementValue(
theClass, (Local) r.getBase(), name, body,
unit, localDefs);
box.setValue(newFieldRef);
if (_debug) {
System.out.println("replacing " + unit);
}
} else {