int ix = 0;
int result = 0;
out.println(" public static SephObject " + name + "(SephObject receiver, SThread thread, LexicalScope scope, MethodHandle[] arguments) {");
SephMethod sm = md.getAnnotation(SephMethod.class);
StringBuilder sb = new StringBuilder();
boolean eval = true;
int arity = -1;
if(sm.evaluateArguments()) {
arity = generateRegularArgumentEvaluation(md, sb);
} else {
arity = generateUnevaluatedArguments(md, sb);
eval = false;
}
out.println(" return " + cd.getQualifiedName() + "." + md.getSimpleName() + "(" + sb + ");");
out.println(" }");
out.println();
getters[ix++] = " l.findStatic(" + cd.getSimpleName() + "Base.class, \"" + name + "\", ACTIVATE_METHOD_TYPE_N)";
tempOut = new StringBuilder();
tempOut.append(" public static SephObject " + name + "(SephObject receiver, SThread thread, LexicalScope scope) {").append("\n");
result = generateForArityMH(arity, 0, md, cd, eval, false);
tempOut.append(" }").append("\n");
if(result == 1) {
out.print(tempOut.toString());
getters[ix++] = " l.findStatic(" + cd.getSimpleName() + "Base.class, \"" + name + "\", ACTIVATE_METHOD_TYPE_0)";
} else if(result == -2) {
getters[ix++] = " l.findStatic(" + cd.getQualifiedName() + ".class, \"" + md.getSimpleName() + "\", ACTIVATE_METHOD_TYPE_0)";
} else {
getters[ix++] = " arityError(" + arity + ", 0, \"" + realName + "\", false)";
}
tempOut = new StringBuilder();
tempOut.append(" public static SephObject " + name + "(SephObject receiver, SThread thread, LexicalScope scope, MethodHandle arg0) {").append("\n");
result = generateForArityMH(arity, 1, md, cd, eval, false);
tempOut.append(" }").append("\n");
if(result == 1) {
out.print(tempOut.toString());
getters[ix++] = " l.findStatic(" + cd.getSimpleName() + "Base.class, \"" + name + "\", ACTIVATE_METHOD_TYPE_1)";
} else if(result == -2) {
getters[ix++] = " l.findStatic(" + cd.getQualifiedName() + ".class, \"" + md.getSimpleName() + "\", ACTIVATE_METHOD_TYPE_1)";
} else {
getters[ix++] = " arityError(" + arity + ", 1, \"" + realName + "\", false)";
}
tempOut = new StringBuilder();
tempOut.append(" public static SephObject " + name + "(SephObject receiver, SThread thread, LexicalScope scope, MethodHandle arg0, MethodHandle arg1) {").append("\n");
result = generateForArityMH(arity, 2, md, cd, eval, false);
tempOut.append(" }").append("\n");
if(result == 1) {
out.print(tempOut.toString());
getters[ix++] = " l.findStatic(" + cd.getSimpleName() + "Base.class, \"" + name + "\", ACTIVATE_METHOD_TYPE_2)";
} else if(result == -2) {
getters[ix++] = " l.findStatic(" + cd.getQualifiedName() + ".class, \"" + md.getSimpleName() + "\", ACTIVATE_METHOD_TYPE_2)";
} else {
getters[ix++] = " arityError(" + arity + ", 2, \"" + realName + "\", false)";
}
tempOut = new StringBuilder();
tempOut.append(" public static SephObject " + name + "(SephObject receiver, SThread thread, LexicalScope scope, MethodHandle arg0, MethodHandle arg1, MethodHandle arg2) {").append("\n");
result = generateForArityMH(arity, 3, md, cd, eval, false);
tempOut.append(" }").append("\n");
if(result == 1) {
out.print(tempOut.toString());
getters[ix++] = " l.findStatic(" + cd.getSimpleName() + "Base.class, \"" + name + "\", ACTIVATE_METHOD_TYPE_3)";
} else if(result == -2) {
getters[ix++] = " l.findStatic(" + cd.getQualifiedName() + ".class, \"" + md.getSimpleName() + "\", ACTIVATE_METHOD_TYPE_3)";
} else {
getters[ix++] = " arityError(" + arity + ", 3, \"" + realName + "\", false)";
}
tempOut = new StringBuilder();
tempOut.append(" public static SephObject " + name + "(SephObject receiver, SThread thread, LexicalScope scope, MethodHandle arg0, MethodHandle arg1, MethodHandle arg2, MethodHandle arg3) {").append("\n");
result = generateForArityMH(arity, 4, md, cd, eval, false);
tempOut.append(" }").append("\n");
if(result == 1) {
out.print(tempOut.toString());
getters[ix++] = " l.findStatic(" + cd.getSimpleName() + "Base.class, \"" + name + "\", ACTIVATE_METHOD_TYPE_4)";
} else if(result == -2) {
getters[ix++] = " l.findStatic(" + cd.getQualifiedName() + ".class, \"" + md.getSimpleName() + "\", ACTIVATE_METHOD_TYPE_4)";
} else {
getters[ix++] = " arityError(" + arity + ", 4, \"" + realName + "\", false)";
}
tempOut = new StringBuilder();
tempOut.append(" public static SephObject " + name + "(SephObject receiver, SThread thread, LexicalScope scope, MethodHandle arg0, MethodHandle arg1, MethodHandle arg2, MethodHandle arg3, MethodHandle arg4) {").append("\n");
result = generateForArityMH(arity, 5, md, cd, eval, false);
tempOut.append(" }").append("\n");
if(result == 1) {
out.print(tempOut.toString());
getters[ix++] = " l.findStatic(" + cd.getSimpleName() + "Base.class, \"" + name + "\", ACTIVATE_METHOD_TYPE_5)";
} else if(result == -2) {
getters[ix++] = " l.findStatic(" + cd.getQualifiedName() + ".class, \"" + md.getSimpleName() + "\", ACTIVATE_METHOD_TYPE_5)";
} else {
getters[ix++] = " arityError(" + arity + ", 5, \"" + realName + "\", false)";
}
out.println(" public static SephObject " + name + "(SephObject receiver, SThread thread, LexicalScope scope, MethodHandle[] arguments, String[] keywordNames, MethodHandle[] keywordArguments) {");
sb = new StringBuilder();
eval = true;
arity = -1;
if(sm.evaluateArguments()) {
arity = generateRegularArgumentEvaluation(md, sb);
} else {
arity = generateUnevaluatedArguments(md, sb);
eval = false;
}