public void getSignature(wyvern.tools.types.Type type, SignatureVisitor sig, boolean baseAllowed) {
if (type instanceof Arrow) {
wyvern.tools.types.Type argument = ((Arrow) type).getArgument();
if (argument instanceof Unit) {
sig.visitClassType(Type.getInternalName(Supplier.class));
SignatureVisitor sw2 = sig.visitTypeArgument('=');
getSignature(((Arrow) type).getResult(), sw2, true);
sw2.visitEnd();
return;
}
if (argument instanceof Tuple) {
wyvern.tools.types.Type[] types = ((Tuple) argument).getTypeArray();
if (types.length == 2) {
sig.visitClassType(Type.getInternalName(BiFunction.class));
SignatureVisitor sw2 = sig.visitTypeArgument('=');
getSignature(types[0], sw2, false);
getSignature(types[1], sw2, false);
getSignature(((Arrow) type).getResult(), sw2, false);
sw2.visitEnd();
return;
}
}
if (argument instanceof Int) {
sig.visitClassType(Type.getInternalName(IntFunction.class));
SignatureVisitor sw2 = sig.visitTypeArgument('=');
getSignature(((Arrow) type).getResult(), sw2, true);
sw2.visitEnd();
return;
}
sig.visitClassType(Type.getInternalName(Function.class));
SignatureVisitor sw2 = sig.visitTypeArgument('=');
getSignature(argument, sw2, false);
getSignature(((Arrow) type).getResult(), sw2, false);
sw2.visitEnd();
} else if (type instanceof Tuple) {
Class genTgt = null;
switch (((Tuple) type).getTypeArray().length) {
case 0: genTgt = null; break;
case 1: genTgt = null; break;
case 2: genTgt = Pair.class; break;
case 3: genTgt = Triplet.class; break;
case 4: genTgt = Quartet.class; break;
case 5: genTgt = Quintet.class; break;
case 6: genTgt = Sextet.class; break;
case 7: genTgt = Septet.class; break;
case 8: genTgt = Octet.class; break;
case 9: genTgt = Ennead.class; break;
case 10: genTgt = Decade.class; break;
default: throw new RuntimeException();
}
sig.visitClassType(Type.getInternalName(genTgt));
SignatureVisitor sw2 = sig.visitTypeArgument('=');
for (wyvern.tools.types.Type tpe : ((Tuple) type).getTypeArray())
getSignature(tpe, sw2, false);
sw2.visitEnd();
return;
} else {
Type rType = getType(type, baseAllowed);
if (rType.getClassName() != null) {
sig.visitClassType(rType.getClassName());