Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Remove experimental unused Method.args from 1.8 era.
Browse files Browse the repository at this point in the history
headius committed May 9, 2015
1 parent a9144eb commit 21ea270
Showing 4 changed files with 10 additions and 12 deletions.
4 changes: 2 additions & 2 deletions core/src/main/java/org/jruby/AbstractRubyMethod.java
Original file line number Diff line number Diff line change
@@ -32,10 +32,10 @@
package org.jruby;

import org.jruby.anno.JRubyMethod;
import org.jruby.ext.jruby.JRubyLibrary;
import org.jruby.internal.runtime.methods.DynamicMethod;
import org.jruby.internal.runtime.methods.IRMethodArgs;
import org.jruby.internal.runtime.methods.UndefinedMethod;
import org.jruby.runtime.Helpers;
import org.jruby.runtime.PositionAware;
import org.jruby.runtime.ThreadContext;
import org.jruby.runtime.builtin.IRubyObject;
@@ -135,7 +135,7 @@ public int getLine() {

@JRubyMethod(name = "parameters")
public IRubyObject parameters(ThreadContext context) {
return JRubyLibrary.MethodExtensions.methodArgs(this);
return Helpers.methodToParameters(context.runtime, this);
}

protected IRubyObject super_method(ThreadContext context, IRubyObject receiver, RubyModule superClass) {
3 changes: 1 addition & 2 deletions core/src/main/java/org/jruby/RubyMethod.java
Original file line number Diff line number Diff line change
@@ -31,7 +31,6 @@
***** END LICENSE BLOCK *****/
package org.jruby;

import org.jruby.ext.jruby.JRubyLibrary;
import org.jruby.anno.JRubyMethod;
import org.jruby.anno.JRubyClass;
import org.jruby.internal.runtime.methods.AliasMethod;
@@ -290,7 +289,7 @@ public int getLine() {

@JRubyMethod
public IRubyObject parameters(ThreadContext context) {
return JRubyLibrary.MethodExtensions.methodArgs(this);
return Helpers.methodToParameters(context.runtime, this);
}

@JRubyMethod(optional = 1)
8 changes: 0 additions & 8 deletions core/src/main/java/org/jruby/ext/jruby/JRubyLibrary.java
Original file line number Diff line number Diff line change
@@ -144,14 +144,6 @@ public static IRubyObject identity_hash(ThreadContext context, IRubyObject recv,
}

public static class MethodExtensions {
@JRubyMethod(name = "args")
public static IRubyObject methodArgs(IRubyObject recv) {
Ruby runtime = recv.getRuntime();
AbstractRubyMethod rubyMethod = (AbstractRubyMethod)recv;
DynamicMethod method = rubyMethod.getMethod().getRealMethod();

return Helpers.argumentDescriptorsToParameters(runtime, Helpers.methodToArgumentDescriptors(method), true);
}

}
}
7 changes: 7 additions & 0 deletions core/src/main/java/org/jruby/runtime/Helpers.java
Original file line number Diff line number Diff line change
@@ -7,6 +7,7 @@

import jnr.constants.platform.Errno;
import org.jruby.*;
import org.jruby.anno.JRubyMethod;
import org.jruby.ast.ArgsNode;
import org.jruby.ast.ArgumentNode;
import org.jruby.ast.DAsgnNode;
@@ -2524,6 +2525,12 @@ public static ArgumentDescriptor[] methodToArgumentDescriptors(DynamicMethod met
}
}

public static IRubyObject methodToParameters(Ruby runtime, AbstractRubyMethod recv) {
DynamicMethod method = recv.getMethod().getRealMethod();

return argumentDescriptorsToParameters(runtime, methodToArgumentDescriptors(method), true);
}

public static RubyString getDefinedCall(ThreadContext context, IRubyObject self, IRubyObject receiver, String name) {
RubyClass metaClass = receiver.getMetaClass();
DynamicMethod method = metaClass.searchMethod(name);

0 comments on commit 21ea270

Please sign in to comment.