return methodSourceLocation(runtime, method);
}
public static IRubyObject methodSourceLocation(Ruby runtime, DynamicMethod method) {
if (method instanceof PositionAware) {
PositionAware positionAware = (PositionAware)method;
return runtime.newArray(runtime.newString(positionAware.getFile()),
runtime.newFixnum(positionAware.getLine() + 1));
} else if (method instanceof ProcMethod) {
RubyProc proc = (RubyProc)getPrivateField(runtime, ProcMethod.class, "proc", method);
String file = (String)getPrivateField(runtime, RubyProc.class, "file", proc);
int line = getPrivateIntField(runtime, RubyProc.class, "line", proc);
RubyString rubyFile = runtime.newString(file);