private static TypeDesc makeDesc(Variable v) {
        if (v.getType() != null) {
            return makeDesc(v.getType(), true);
        } else if (v.getTypeName() != null) {
            return makeDesc(v.getTypeName().getName());
        } else {
            throw new IllegalStateException("missing type: " + v.getName());
        }
    }