// System.out.println("flowing " + d + " " + in);
// By default, the out is equal to the in.
copy(inValue, outValue);
if (stmt instanceof InvokeStmt) {
Value expr = ((InvokeStmt) stmt).getInvokeExpr();
if (expr instanceof SpecialInvokeExpr) {
SpecialInvokeExpr r = (SpecialInvokeExpr) expr;
//String methodName = r.getMethod().getName();
Type type = r.getBase().getType();
// System.out.println("baseType = " + type);
// System.out.println("methodName = " + methodName);
if (type instanceof NullType) {
// Note: The control path that causes this to be
// null should never occur in practice.
return;
}
SootClass baseClass = ((RefType) type).getSootClass();
// FIXME: match better.
// If we are invoking a method on a token, then...
if (SootUtilities.derivesFrom(baseClass,
PtolemyUtilities.tokenClass)) {
if (r.getMethod().equals(
PtolemyUtilities.arrayTokenConstructor)) {
// The arrayToken constructor depends on the type
// of its constructor argument.
// System.out.println("found array invoke: " + r);
// System.out.println("Argument type is : " + in.get(r.getArg(0)));
ptolemy.data.type.Type argType = (ptolemy.data.type.Type) in
.get(r.getArg(0));
if (argType == null) {
argType = BaseType.UNKNOWN;
}
out.put(r.getBase(), new ArrayType(argType));
} else if (r.getMethod().equals(
PtolemyUtilities.arrayTokenWithTypeConstructor)) {
// The arrayToken constructor depends on the type
// of its constructor argument.
// System.out.println("found array invoke: " + r);
// System.out.println("Argument type is : " + in.get(r.getArg(0)));
ptolemy.data.type.Type argType = (ptolemy.data.type.Type) in
.get(r.getArg(0));
if (argType == null) {
argType = BaseType.UNKNOWN;
}
out.put(r.getBase(), new ArrayType(argType));
}
}
}
} else if (stmt instanceof AssignStmt) {
Value leftOp = ((AssignStmt) stmt).getLeftOp();
if (!_isTokenType(leftOp.getType())) {
// System.out.println("type " + leftOp.getType()
// + " is not a token");
return;
}
// System.out.println("from " + in);
Value rightOp = ((AssignStmt) stmt).getRightOp();
if (rightOp instanceof StaticInvokeExpr) {
StaticInvokeExpr r = (StaticInvokeExpr) rightOp;
if (r.getMethod().equals(PtolemyUtilities.arraycopyMethod)) {