public ErlangLabel convertErlToMod(Label lbl) {
if (!(lbl instanceof ErlangLabel))
throw new IllegalArgumentException("cannot convert non-erlang labels");
ErlangLabel label = (ErlangLabel) lbl;
FuncSignature origFunc = parent.sigs.get(label.callName);
if (origFunc == null)
throw new IllegalArgumentException("unknown function \"" + label.callName + "\" in module "
+ parent.getName());
// At this point, we know which function should correspond to this label,
// it is worth checking whether the function already associated with the label
// is the correct function,
if (label.function != null) {
if (!label.function.toErlangTerm().equals(origFunc.toErlangTerm()))
throw new IllegalArgumentException(
"label already has a function assigned and it is a different function, " + "was : "
+ label.function + ", now: " + origFunc);
}
return new ErlangLabel(origFunc, label.callName, label.input, label.expectedOutput);